x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Drawing on one Whiteboard (Render Target) is copied to all Whiteboards?

I'm using the Unreal Engine 4 VR Content Examples where it has a whiteboard you can draw on. It uses render targets to render the line to the canvas.

The problem is, when I copy the whiteboard to use somewhere else in the level, it shows the same drawing, like this:

alt text

Here is the material and texture I am using:

alt text

I tried to make a copy of the material and the texture and use it on one of the whiteboards but it has the same result. I'm not sure why the render target is not instanced/unique? Why is it drawing on the same thing on multiple instances of the whiteboard?

Product Version: UE 4.20
Tags:
untitled.png (1.2 MB)
untitled2.png (40.3 kB)
more ▼

asked Sep 16 '18 at 10:03 PM in Rendering

avatar image

Katianie
151 27 20 29

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

In the construction script you need to "create dynamic material instance" then promote it to a variable. Assign that material instance to the board material and use that instance throughout the blueprint.

more ▼

answered Sep 16 '18 at 10:51 PM

avatar image

IndieGameCove
843 4 4 10

avatar image Katianie Sep 17 '18 at 12:07 AM

I think I tried to do what you are saying, here is the code I used to try and create a dynamic material instance but It still had the same problem:

     myRenderTarget = CreateRenderTarget2D(1024, 1024, ETextureRenderTargetFormat::RTF_RGBA16f);
     UMaterialInstanceDynamic* rtMaterial = UMaterialInstanceDynamic::Create(myBoardMaterial, this, FName("RenderTargetMaterial"));
     rtMaterial->SetTextureParameterValue(FName("BaseColor"), myRenderTarget);
     myBoardComponent->SetMaterial(0, rtMaterial);
avatar image Katianie Sep 17 '18 at 05:28 PM

Any other ideas? I tried making a material instance of the original material and setting it as the material for the board but still the same issue.

avatar image IndieGameCove Sep 17 '18 at 11:29 PM

I'm not sure whether or not the code is correct cause I generally use blueprints for that. you could double check that the BaseColor parameter matches the name in the material. And you could delete the render target that the whiteboard was originally using. if that causes it to break somehow then the whiteboard is still trying to write to it somewhere.

avatar image IndieGameCove Sep 17 '18 at 11:32 PM

also there is a spelling error for the render target in your pic, so make sure that isn't cause some error.

avatar image Katianie Sep 18 '18 at 02:24 AM

Can you show me the blueprint code of what you have? I'm trying to make the texture render target 2d dynamically, then pass it to the dynamic material instance, then set the material once the game starts and I can see the white for the white board but I cannot draw on it. Since I couldn't draw on it, i tried just executing this code for one of the whiteboards but it still had the original issue even when dynamically creating the texture render target (draw on one, see on all).

avatar image IndieGameCove Sep 19 '18 at 03:23 AM

alt text

[1]: /storage/temp/254049-whiteboard02.png

whiteboard01.png (455.8 kB)
whiteboard02.png (138.1 kB)
(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question