Can a compute shader be made to do triangle ray intersection?
I have an idea I want to make with ray tracing.
I want to use portal and cell as acceleration structure.
It works like there are wall triangles and portal triangles.
The portal is intersected by a ray then the ray is checked in the next cell for intersection with wall or portal.
Not normally.
DX12 supports ray tracing, but it requires HDRP (or a custom SRP) and takes quite a bit of effort to get right. It also requires GPU support (RTX on!). If you want to go that route, you’d typically use a ray generation shader et al, but you can do it in a compute shader with inline ray tracing. I got it working at one point, but it’s not super well documented.
But there are other ways to do portals which work on all platforms, eg multiple cameras, render textures, vertex hacks, etc, etc. Can you maybe show a diagram or screenshot of what you’re going for?
I’m using portals and cells to control overlapping geometry.
I had this idea to fire a bunch of rays from the camera and to use the rays and portals to render the cells I want.
Cells contain polygons and portals.
If a ray hits a portal then the next cell is checked for intersection.
The cell with the camera in it is first checked then if a ray hits a portal triangle then cell behind the portal is checked.
I was thinking ray tracing would give me full control for rendering pixels to screen using triangle intersection.