God Rays - addons for openFrameworks?

Hello there fellows,
I am trying to create some abstract geometric art - which would be rendered at the maximum settings that my computing can push it. I want to explore adding god rays to it. How would one implement semi-realistic looking god rays coming out from, say, spotlights which are blocked by other geometry surrounding it?

Also are there any ray-tracing addons that work right out of the box to create realistic looking scenes, or is this a more advanced feat?

Thank you all in advance :slight_smile:

Hi iridule,

I’ve never done this personally but I think you’d want to approach it with a particular shader. You could apply that shader to the drawing of the objects that need to have god-rays.

Do you have any experience with GLSL shaders?

JB

Hello Bentley,

I am, unfortunately, quite new to shaders but I thought that perhaps there were some prewritten shaders that I could implement in my code.

I am able to add shaders to my projects that other people have written provided that it has some clarity in it implementation and play around with some properties and add a few minor adjustments here and there.

I have seen some shaders in THREEjs that need a lot of setup/uniforms to be passed in.

Do you have any examples of shaders that I can use? Any resources for free/open source shaders.

Thanks :slight_smile:

this part of the ofBook
http://openframeworks.cc/ofBook/chapters/shaders.html

To start learning shaders with a god ray effect can be hard and frustrating. I would suggest you to begin with something easier first.

Hi, @iridule

Before, I’ve implemented an example based Nvidia GPU Gems 3.
I do not understand an algorithm so far, but I hope It helps you.

1 Like

Hey @edapx,

Thanks for the link :). I will try to experiment with effects on book of shaders and apply them in openFrameworks.

and @yuma_taesu
Thank you also! This looks great. How did you manage to port the code into ofx?

I do not think it matters at this point - for me - to understand the code just yet but i’ll add it to my list.

Thank you all, I will play around with the addons and shaders see what I can come up with.

Peace :rabbit: :smile:

Hi ! It’s maybe a bit late but here’s a great addon that implements the God Rays effect : https://github.com/neilmendoza/ofxPostProcessing

1 Like

Also late! But I have half a blog post that explains how to implement light shafts, I actually had that working in an old OF version. (Here it is).

I’m now trying to make an emscripten version that implements this but it’s coming slower than I expected. :slight_smile:

This method assumes the light source is facing the viewer. There’s a different method that uses ray marching and produces better results.

Hope it helps!

3 Likes

Hey all, a bit of a late reply but I have been watch this thread closely.

@alkex1982 thank you! the effects in this are amazing and I am to produce some interesting effects by layering effects on top of each other.

I have one issue though - I had to go inside the ofxPostProcesing source code and literally declare an enum:

enum ofFboBeginMode {NoDefaults};

Now I do not know why this issue had occurred, I do not have the nightly build so perhaps that is why the error is happening. Is there a dependency that I am missing? This could be useful to someone else - so if someone could let me know what the reason could be that would be amazing.

I am on Linux - if that makes any difference. Anyhow - I got postProcessing to work!

@chuckleplant thank you for this! I will take a look at this, keep it as reference and come back to it when I have gotten more comfortable with shaders .

Thank you guys :smile_cat: