One of the big concerns as I start the next part of my project is cubemaps and reflections. My environment is very shiny and sci-fi, and will be heavily dependent on cubemaps.
As far as my understanding right now, each time I use a new cubemap, I will need to create a new material instance specifically for that cubemap. That's a lot of material instances for a lot of objects that need duplicates just to swap the cubemap. Also, because of static switch parameters, each time the game cooks it is going to create a separate material. This will lead to an exponential amount of instances being cooked because I may need to make 20 versions of the same instance with a different cubemap plugged in.
My question is, how do I get around this? What are suggestions for optimizing with cubemaps? Is the general suggest to avoid or fake it as much as possible (or wait until UE4 when everything is just real time reflections anyway? :poly142: )
Does anyone have thoughts on how to go about this so I don't have 400 different material instances for 40 different cubemaps?
Replies
Thanks guys. I've been sticking with UDK out of stubbornness, I may look into CryEngine soon enough since it can achieve what I am looking for probably much easier.
You could lerp between two, OR you could just have the new cube pop in, or you could have a generic shiny cubemap that you always fade to based on distance as you transition between specific cube maps.
Wouldn't I still need to call every material instance in code if I'm overriding the cubemap parameter? That's the issue I was concerned with. Or could I make one MaterialInstance, then create all others based from that, and only override the parent's cubemap parameter?
I'll try some tests and see what I can end up with. Lerping between the two options based on distance is probably doable.
I also may be overly worried. The main reflection will be coming from the floor, which will just have a reflect actor anyway. Most of the cubemaps will be blurred and so I will probably only need a few unique ones.
Once you get which cube or cubes to use.. and however you build the distance formula to lerp between them.