Skip to content
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

Add an example for AccelerationStructure #2308

Open
marc0246 opened this issue Aug 26, 2023 · 3 comments · May be fixed by #2314
Open

Add an example for AccelerationStructure #2308

marc0246 opened this issue Aug 26, 2023 · 3 comments · May be fixed by #2314

Comments

@marc0246
Copy link
Contributor

Introduced in #2213, but still not covered by any examples.

@atynagano
Copy link

I'm personally implementing an example then encountered #2312.

@atynagano
Copy link

I wrote a very simple example program for ray query and acceleration structure like below. So, can I make a PR and have it reviewed?

                void main() {
	                float t_min = 0.01;
	                float t_max = 1000.0;
	                vec3 origin = vec3(0.0, 0.0, 0.0);
	                vec3 direction = vec3(in_uv * 1.0, 1.0);

                    rayQueryEXT ray_query;
                    rayQueryInitializeEXT(
                        ray_query,
                        top_level_acceleration_structure,
                        gl_RayFlagsTerminateOnFirstHitEXT,
                        0xFF,
                        origin,
                        t_min,
                        direction,
                        t_max
                    );
                    rayQueryProceedEXT(ray_query);

                    if (rayQueryGetIntersectionTypeEXT(ray_query, true) == gl_RayQueryCommittedIntersectionNoneEXT) {
                        // miss
                        f_color = vec4(0.0, 0.0, 0.0, 1.0);
                    } else {
                        // hit
                        f_color = vec4(1.0, 0.0, 0.0, 1.0);
                    }
                }

image

@Rua
Copy link
Contributor

Rua commented Aug 27, 2023

Absolutely!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants