October 28, 2012

shader based cube environment mapping

I present you a pure shader based cube environment mapping. It might be useful for those who, for whatever reason, does not have "samplerCube" texture type support in their engine or want some more flexibility or customization for envmaps. It is a tiny bit slower than the proper version and mip-mapping is not working well, so it is pretty much useless.
This paper helped me a lot:

Anyways, the input can be 6 separate textures or cube environment map Blender style. A standard OpenGL style alignment is on the way.

shader HERE

screenshots are in previous post :)


  1. This comment has been removed by the author.

    1. I was a bit confused about BPCEM and this thing, so I deleted my other comment after realizing that I got it wrong.

      I am wondering what is the advantage of having a shader based CEM instead of the vanilla one? Was it because of your effort of making a real-time CEM that it was shader based?

    2. Hey Martin!
      Well the only advantage is that you don't need an extra texture type support other than texture2D in OpenGL. Why I made it - yeah, simply because it was the only way to have real-time CEM working in Blender :) - render 6 textures with videotexture module and fetch them in a shader. It is more a proof-of-concept rather a feature.

      As goes for BPCEM:
      Well using this together with BPCEM would not be necessary as real-time CEM is rendering the scene of the reflective objects relative position.


    Martinsh i think you should take a look at this, really interesting technology, i think there are also some papers describing how it works :) i dont think we'll get something like that to work in blender but haha its still pretty interesting :)

    1. Hey Ivan,
      Yeah I am a fan of Eric Bruneton and his creations. It is really impressive what he has done there. The source is actually availabe for this, but it is pretty much impossible with my skills to implement it in Blender. But I am planning to make something quite similar.