- Home /
Dynamically setting cubemap for shader skybox/cubemap in unity 5
I wont bore you with the scenario but I am trying to dynamically create a skybox based upon the scene.
So I put a camera in the center render it out to a cubemap using RenderCubeMap
then create a new Material using the skybox/cubemap
shader. This all seems to work but I cannot figure out how to set the actual cubemap texture, I have tried using materialSetTexture("_Cube", myCubemap)
tried changing the name to "Cubemap"
tried setting the mainTexture
even tried to use the index based method passing in 0, just nothing ever seems to show up in the texture for the material thats been created.
I cannot find any documentation on what the shaders vars are, other than the unity default _Cube
name, so am I doing anything obvious which is wrong? if not can anyone confirm if the texture name in the shader.
Answer by nikpundik · Sep 03, 2015 at 02:37 PM
Hi @Macro, try with _Tex
Although this now adds the texture it only seems to render 1 side of it, I have tried passing in 63 as the face$$anonymous$$ask, but was leaving it as default too, have even tried using RenderTexture as the container (with isCubemap
) rather than a direct Cube$$anonymous$$ap, still no luck :(
Upon further investigation if I set dont clear it does seem to be outputting everything, but I am not sure if it is somehow just culling everyone off the screen or something when it does the renderToCubemap...
Your answer
Follow this Question
Related Questions
Having static objects in scene disables skybox reflections. 0 Answers
Failed to find compatible Skybox shader 1 Answer
Skyboxes missing from standard assets in unity 5 3 Answers
Download 6 textures from the web, create a cubemap and set it as skybox in runtime 0 Answers
Calculating position of projected object in reflection 1 Answer