Announcement

Collapse
No announcement yet.

Whiteboard Blueprint

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Whiteboard Blueprint



    I created this Whiteboard as a learning experience, just to see if it could be done.
    It's being released to the public to learn and adapt for yourselves.

    Three things to note before you download.
    First, i am not 100% sure this is the best way of doing this, basically we're spawning a decal on every tick so it may or may not be viable, performance wise.
    The second, I couldn't find a way of deleting the decals after spawning them, which means that I did not add an eraser.
    And lastly there seems to be a feature built in the engine which deletes all decals if there are too many, you will notice this happen after a white of using it, would be nice if an Unreal Developer could chime in with anymore info on that matter.

    So anyway, enjoy!
    Don't forget, if you find better ways of doing this, please share it with this thread.

    As always, this model and blueprint was done by myself and you are free to use it in your own project, commercial or otherwise.



    Download = https://drive.google.com/file/d/0Bwc...it?usp=sharing
    Last edited by Divinitize; 08-17-2014, 08:38 AM.

    #2
    Nice! I created my own drawing system and ran into the decal issues too!
    Full Time UE4 Tutor! www.tesla-dev.com
    Watch, Learn & Create using my tutorials here: *https://www.youtube.com/playlist?lis...8Zjziv4gUqjLZ_*

    Comment


      #3
      Thank you very much!

      Comment


        #4
        This is really cool! I like your 'out of the box' thinking. Do you think this could be implemented in a game? So, the player could run up to the board, write something and run off again?

        Cheers

        Jay.
        Portfolio Website - www.jforthdesigns.co.uk

        Comment


          #5
          Fantastic job Divinitize! Worked great when I tried it out the other day. Keep up the great work and hope to see more of your projects in the future!

          Comment


            #6
            Originally posted by Unfamillia View Post
            This is really cool! I like your 'out of the box' thinking. Do you think this could be implemented in a game? So, the player could run up to the board, write something and run off again?

            Cheers

            Jay.
            Yep, you should just be able to right click on the whiteboard folder and hit migrate, choose your projects content folder and you're good to go.
            You can then just drag out the whiteboard blueprint and place it where you want, however be wary of the spawn decal nodes transform, you might need to change the rotation of the spawned decals if using it on a different axis compared to mine.

            Comment


              #7
              @Divinitize - I have some code you may find interesting, for making a UTexture2D out of a color data buffer.

              If you want it I can clean it up and send it over, it should be possible to create a more robust whiteboard using it by simply keeping around a buffer of your color data and updating the texture each time the user changes the data in the buffer. Then it's just a matter of setting the texture onto a dynamic material instance (to be used by the whiteboard mesh).
              Storyteller - An immersive VR audiobook player

              Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

              Comment


                #8
                Originally posted by n00854180t View Post
                @Divinitize - I have some code you may find interesting, for making a UTexture2D out of a color data buffer.

                If you want it I can clean it up and send it over, it should be possible to create a more robust whiteboard using it by simply keeping around a buffer of your color data and updating the texture each time the user changes the data in the buffer. Then it's just a matter of setting the texture onto a dynamic material instance (to be used by the whiteboard mesh).
                I appreciate the offer, however i am not familar with c++ in any way, but if you want to post it here anyway im sure somone will find some use for it.
                Thanks.

                Comment


                  #9
                  Originally posted by Divinitize View Post
                  I appreciate the offer, however i am not familar with c++ in any way, but if you want to post it here anyway im sure somone will find some use for it.
                  Thanks.
                  You could use it as a Blueprint node quite easily, actually, though my code would need some changes, as you'd probably want to use an array of FColors in Blueprint. Anyway, I'll make some changes to it so it'd be easier to use in Blueprint, test it out and upload it somewhere here. Should be useful for a lot of purposes
                  Storyteller - An immersive VR audiobook player

                  Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                  Comment


                    #10
                    Whoa - this is super cool!
                    Let's Connect [Twitter]

                    Comment


                      #11
                      thanks for sharing it

                      Comment


                        #12
                        Originally posted by n00854180t View Post
                        You could use it as a Blueprint node quite easily, actually, though my code would need some changes, as you'd probably want to use an array of FColors in Blueprint. Anyway, I'll make some changes to it so it'd be easier to use in Blueprint, test it out and upload it somewhere here. Should be useful for a lot of purposes
                        I'd be interested in seeing your code.

                        Comment


                          #13
                          Oh Man thanks a bunch for this whiteboard project.
                          This get me started to make Tire mark on the ground.
                          I'll obviously set the decal lifespan to be limited for the tire track
                          RinDream.com
                          RinCity-TrainStation UE4 Technical Breakdown
                          Rin Blueprint DicePack
                          twitter.com/RinDream

                          Comment


                            #14
                            Thanks for the project!

                            Comment


                              #15
                              Originally posted by JonTerp View Post
                              I'd be interested in seeing your code.
                              Sure! Another user requested it as well. The way of doing it I mentioned in my last post isn't as good as the method I came up with (which uses a render command to actually update the texture, which means its outside the game thread and shouldn't cause any hanging there).

                              Currently this is untested, so let me know if you run into problems and I'll do what I can to fix them (more info to debug the better), though it *should* work.

                              I'll be adding this code to my TextureFromDisk plugin repo, as well as passing it off to Rama if he'd like to include it in his BP library (which is better maintained across versions than my plugin repo), but I'll share it here just to get it out quickly.

                              The first thing is to add this function to your code:

                              https://wiki.unrealengine.com/Dynamic_Textures (UpdateTextureRegions is what you want)

                              Next, here's the declaration for the Blueprint node function:

                              Code:
                              	
                                      /** Updates a UTexture2D* from an FColor array.
                              	* Update texture from color data.
                              	* @param ColorData		Array of FColors to update this texture with. Array is assumed to be the same dimensions as texture, otherwise this call will fail.
                              	* @param Texture		Texture to update.
                              	*/
                              	UFUNCTION(BlueprintCallable, Category = "TextureFromDisk")
                              	static void UpdateTextureFromColorData(TArray<FColor>& ColorData, UTexture2D* Texture);
                              And the definition:

                              Code:
                              void UTextureFromDiskFunctionLibrary::UpdateTextureFromColorData(TArray<FColor>& ColorData, UTexture2D* Texture)
                              {
                              	// Sanity checks.
                              	if (!Texture)
                              		return;
                              
                              	if (ColorData.Num() <= 0)
                              		return;
                              
                              	// Update region.
                              	FUpdateTextureRegion2D *region = new FUpdateTextureRegion2D(0, 0, 0, 0, Texture->GetSurfaceWidth(), Texture->GetSurfaceHeight());
                              
                              	// Call the render command.
                              	UpdateTextureRegions(Texture, 0, 1, region, Texture->GetSurfaceWidth() * 4, 4, (uint8*)ColorData.GetTypedData(), false);
                              }
                              You'll want to get a blank texture of whatever size you need set up first, along with a material. Then you'll need an array of FColors, which should be sized the same as the number of pixels in your Texture2D (width * height = number of elements).

                              When your user clicks or what not, update the FColors at the correct X/Y locations. Then call the Blueprint node there and pass in the color array and Texture.

                              Right now it's set up to update the entire texture at once, due to the warning mentioned on the wiki page for the Dynamic Textures code. I haven't tested whether or not it actually works with sub regions correctly, but it should be easy to extend to do that.

                              Edit: Right now the way it's set up it will leak the FUpdateTexture2D - so you may want to change UpdateTextureRegions to free the FUpdateTextureRegion2D but NOT the SrcData pointer, because that refers to your TArray of FColors, which you don't want freed.

                              To fix that, change this in UpdateTextureRegions

                              Code:
                              	
                              	if (bFreeData)
                              	{
                              		FMemory::Free(RegionData->Regions);
                              		FMemory::Free(RegionData->SrcData);
                              	}
                              to this:

                              Code:
                              	if (bFreeData)
                              	{
                              		FMemory::Free(RegionData->Regions);
                              	}
                              If you change this, make sure to change the last parameter for UpdateTextureRegions to be true, so it will actually free the FUpdateTextureRegion2D.
                              Last edited by n00854180t; 09-26-2014, 07:45 PM.
                              Storyteller - An immersive VR audiobook player

                              Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

                              Comment

                              Working...
                              X