Grab Texture On Mesh and Export as Flat Image by UV

hmmmkay… so lets say I have a sphere and on this sphere I have a shader that I am using to generate a set of data.

Now can I take this information from the GPU and pass it back to a canvas or a buffer?
Sense the sphere is technically got a uv from 0-1 I could essentially map back all of the colors at the uv points divided by resolution back to a flat image for later use if I can get the information to bounce back.

The reason why I ask is I am trying to generate noise normals on a shape and then store that data back onto a dynamic texture.

figured this can be accomplished by and RTT as long as I get the sample spaces correct.

I think I can make the positions be:
vec4 p = vec4(vec3(uv, 0.0), 1.);
and then capture the RenderTargetTexture of that mesh.

Something like this:

One step closer.

need help with the FOV of the camera support in the shader vx so that the positions are exact, cause right now I am just using hacky values to make it “work” so I can move on.

Got it

1 Like

you rock!

:slight_smile: things are heating up.


So in order to control what is being seen by the camera, I need to exclude all other meshes but the “target”

I have tried layer masks, but this only seems to work when I do one pass.
Is there a easy way to have a camera only render a specific mesh, besides layerMask?

One way I tired but could not get to work was toggle all the activeMeshs to false and store which are which in an array, then reenable all of them after I was done. but that did not seem to work either.

Got it

You have to have a unique ID for the shaders on the effect store and cant just reuse the same name when changing the shader.

1 Like

Man you are faster than me to reply to your own question!! Congrats :smiley:

Yeeee haw:

1 Like


Congrats mate!

Im actually having trouble getting the rotation to work right. Maybe someone could help?

Line 50 is where it is applied on the shader;
Line 681 is where the rotation Matrix is grabbed. but for some reason this is not working.
The Dark shadow should stay away from the sun, and you should never be able to see the clouds on the darkside.

nm got it

1 Like

let’s rename this topic: Self-answered topic ;D

Well Im actually struggling with getting correct normals.

I need to convert my normals to tangent space, but I am a space cadet and am not having a good time…

material.useObjectSpaceNormalMap = true

Jeeeez… yall have thought of everything!

Was able to do everything I wanted with the StandardMaterial after I generated the maps with my function.
Powering up everyday!
And here is a different style Planet:

Just gotta figure out how to convert from Object Normal Space to Tangent Space on the dataPass and everything will be golden!

Rats I should have read the forum before :frowning:But luckily you found the object space normals :wink:

Yeah, that unfortunately does not work when you rotate the mesh. But, on a good note I changed my method and just generate the tangent normal map from the height map now.

I also shifted all the textures to cubemaps and changed the planet to a 6 plane sphere to get rid of all artifacts.

Last night I finished my gradient editor so I am tying to get that all into a WYSIWYG planet editor for my project.

1 Like

can wait to see the final result