ofShader and ofLight in 0.9

Hi all!

As I’m learning shaders and trying to grasp the concepts and power of them perhaps this question comes out of lack of understanding how they and OF truly works. What I’m trying to achieve is having a custom ofShader working with ofLight together in 0.9.

I’m able to get the light working with ofMaterial, but now I’m trying to do some texture mapping in a shader on a sphere with additional lights and that’s proving to be more tricky that I’ve anticipated.

Before starting I assumed this would be a simple enough task :slight_smile: (silly me!) I’ve gone through the nightly build examples but can’t seem to find anything that’s set up in such a way. Perhaps it’s not a good way to do it?

What I’m making is our lovely Earth, of course, and as you can see, it needs some sun-rays badly :slight_smile:

ofMaterial in 0.9 (if you are using the prgrammable renderer, with gl 3 or more) is using shaders to render the lighting… there’s no way in openGL to bind 2 shaders at the same time so, until we figure out a way to somehow extend the default shaders, there’s no way to combine ofMaterial and a custom shader.

you can though use the material properties and read the positions of the lights to create your own materials, you can even copy the default materials shaders in ofMaterial.cpp and modify them to add whatever features you need.

another possibility is to add effects in post processing: render the earth in one pass and then add the sun rays as post processing effects in a second pass.