Is it possible to create a cubemap of the entire surrounding scene during run-time?
–Eric
Thanks!
Hm, it doesn’t seem to be working though…
var Cam : Camera;
private var EnvCubemap : Cubemap;
//...
function Update ()
{
Cam.RenderToCubemap( EnvCubemap );
//...
renderer.material.SetTexture( "_EnvMap", EnvCubemap );
}
I get an error saying:
“Cubemap must not be null!”
What am I doing wrong?
Edit - I’ve found that the function is returning false. Does that mean my gfx card doesn’t support whatever the function is doing underneath?
When you declare EnvCubemap as a private variable, its value is null. Make it public, create an empty cubemap, and assign it to the variable.
HTH.
Hmm, now it doesn’t return false, but it doesn’t work either. Odd…
Does it produce any errors, or simply not do anything? :?
I’ve got it working now, by creating the new cubemap in script uing it’s new.
Only problem is it’s very slow, so I can only do it once, which defeats the purpose of it :P. Well, I’m sure other people with faster comps can make it work well
Does the code example at RenderToCubemap docs work for you? If it does, and your script does not, then probably there’s some error in your script.