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"

How to dynamically create many textures from RenderTarget2D

Hello.

I have a default material with two texture parameters (which is used to create a Dynamic Material Instance).

I need to create two textures, from differents USceneCaptureComponent2D, and blend them together in my dynamic material instance. Each of these capture components have an associated TextRenderComponent.

What I believe is needed to be done:

  • Set the text into the TextRenderComponent

  • Wait a frame (one) for the geometry to be built by the engine

  • Create the textures

  • Copy the color data from the USceneCaptureComponent2D into the created textures

  • Assign the created textures as texture parameters into the Material Instance Dynamic.

To wait the frames I'm using a Tick event callback. I could achieve the creation of many actors with different texts as their textures using one USceneCaptureComponent2D. When I added the second one, the game just turns all the "text textures" into the same one.

I have certified myself that I'm using a different material instance for each actor.

Am I missing something? Should I use another method?

Background for the project: I'm creating an online card game that contains many cards with different texts on it. My project already has a server implemented and all the card information is on a SQL Database.

Product Version: UE 4.8
Tags:
more ▼

asked Sep 11 '15 at 05:49 PM in Rendering

avatar image

htsukebe
26 1 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hello,

Solved my issue. Still don't know exactly how the render pipeline works with said components in my question, but I can provide the required steps necessary to achieve the texture generation with USceneCaptureComponent2D:

  • Make sure the texture parameters in the material are being found with the correct name (With this method)

  • You do have to wait between frame renders after generating text geometry and flushing the scene capture component data into a texture. This is the part where I don't know much about, but my code worked having the geometry, each texture and material parameter assignment working in different ticks with a "dummy" tick between them.

  • Do not capture every frame with the Scene Capture Component. I set this member to false in my blueprint and passed it as an argument to my initializer methods (I use two Scene Capture Components, as I blend two textures in different ways in a material), so I could invoke them later in C++.

  • Used this code to capture my render target data into a texture.

  • Used this method for both scene capture components after text geometry generation and before flushing the render target content into the texture (only for the appropriate scene capture component).

There is a significant fps drop while rendering the textures, but this is a problem for another question.

more ▼

answered Sep 13 '15 at 03:21 AM

avatar image

htsukebe
26 1 3 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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