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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to run C++ code on the GPU?

Hello, I would like to generate procedural textures using RenderTargets. I could always do it on the CPU (at least that's where I suppose the BeginDrawCanvasToRenderTarget method is executed), but I wonder if there is a faster way to do it? Can I draw on RenderTargets from the GPU? Or using compute shaders? I know I'm shooting in the dark here, but I'm hoping you guy can give me some ideas where to aim.

Thank you :)

Product Version: UE 4.21
more ▼

asked Nov 26 '18 at 12:08 AM in C++ Programming

avatar image

8 1 2 4

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

1 answer: sort voted first


I must admit I haven't used RenderTargets yet, but here's some general knowledge on procedural textures :) You can create procedural texture in materials. The speed will probably depend on how you are using it. If you are generating texture on CPU and then sending it to GPU to use it in material than it would be faster to generate it on GPU obviously :)

Getting generated texture from GPU to CPU is always a pain so you might need to consider if that's worth your time.

Texture generated on GPU is a bit different than in CPU in my experience. Consider GPU is a highly paralleled environment you are not really creating a texture as a 2D array, but rather computing what value should given pixel/vertex have. This saves up some storage time, allows you to sample procedural texture in parallel and use it right away in the material.

If you want to use it outside of GPU, you might be able to code it into PostProcess material probably, but it will still not might be worth it.

Hope it helps.

more ▼

answered Nov 26 '18 at 02:57 AM

avatar image

78 4 5

(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