Skip to content

Added AOV output support to the Raymarching engine #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

shadielhajj
Copy link
Collaborator

@shadielhajj shadielhajj commented Jul 30, 2024

Added AOV (Arbitrary Output Variables) output support to the Raymarching engine.
These additional buffers are very useful for post-processing passes. And the good news: they come almost for free, as raymarching already provides us with this data!

We now have:

Color
Screenshot 2024-07-30 172548

Alpha
Screenshot 2024-07-30 172619

Eye Depth
Screenshot 2024-07-30 172534

World Position
Screenshot 2024-07-30 172512

World Normals
Screenshot 2024-07-30 172450

And finally, to illustrate, some DOF fun using the Eye Depth AOV and Lygia's sample/dof

Screenshot 2024-07-30 175913

@shadielhajj shadielhajj changed the title Add AOV output support Added AOV output support Jul 30, 2024
@shadielhajj shadielhajj changed the title Added AOV output support Added AOV output support to the Raymarching engine Jul 30, 2024
@patriciogonzalezvivo
Copy link
Owner

Omg! brillant! this open the door for SO many fun stuff!
LOVE IT!

@patriciogonzalezvivo patriciogonzalezvivo merged commit bd290df into patriciogonzalezvivo:main Jul 30, 2024
st.x = 1.0 - st.x;

#if defined(RAYMARCH_MULTISAMPLE)
vec4 color = vec4(0.0);
eyeDepth = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to 0.0 older versions of GLSL don't do implicit casting

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, sorry. Keep forgetting about this, as I'm testing under OpenGL 4.5 and Unity, but not WebGL.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! I'm sorry to bring it up later. I will do my part better and watch for those running against OpenGL ES 2.0 (you can't get older than that : )

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Just PRed a fix.

vec2 pixel = 1.0/RESOLUTION;
vec2 offset = rotate( vec2(0.5, 0.0), HALF_PI/4.);

for (int i = 0; i < RAYMARCH_MULTISAMPLE; i++) {
vec3 rd = ca * normalize(vec3((st + offset * pixel)*2.0-1.0, fov));
color += RAYMARCH_RENDER_FNC( camera, rd);
float sampleDepth = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0

@shadielhajj shadielhajj deleted the feature/aov branch July 30, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants