ray-tracing-renderer icon indicating copy to clipboard operation
ray-tracing-renderer copied to clipboard

GBuffer/zbuffer/material in bitmap/array format

Open nicolab28 opened this issue 4 years ago • 2 comments

I guess it must exist, but I can't get my hands on it. Is there a gbuffer, zbuffer, material buffer in bitmap / array somewhere? I may have searched poorly? Thanks.

nicolab28 avatar May 05 '20 07:05 nicolab28

Are you asking in regards to adding user-defined IOR support? If so, here are probably the most relevant files:

  • The material buffer is implemented as a uniform buffer object: https://github.com/hoverinc/ray-tracing-renderer/blob/master/src/renderer/glsl/chunks/materialBuffer.glsl
  • You can upload data to it here https://github.com/hoverinc/ray-tracing-renderer/blob/master/src/renderer/MaterialBuffer.js
  • And the IOR should be set on the SurfaceInteraction struct from the material buffer here: https://github.com/hoverinc/ray-tracing-renderer/blob/master/src/renderer/glsl/chunks/surfaceInteractionDirect.glsl (for primary intersections) and https://github.com/hoverinc/ray-tracing-renderer/blob/master/src/renderer/glsl/chunks/intersect.glsl (for secondary intersections)
  • Which finally can transmit light accordingly here https://github.com/hoverinc/ray-tracing-renderer/blob/master/src/renderer/glsl/chunks/sampleGlassSpecular.glsl

Sorry, it's a pretty complex change so that might be confusing. I can try to help out if you have questions.

jaxry avatar May 05 '20 08:05 jaxry

Thank you very much, I looked a little, and I'm starting to understand some stuff. However, I was talking about zbuffers gbuffers. Bitmaps which store the depth information, material identifier on each pixel ... To make masks and postprod retouching

nicolab28 avatar May 05 '20 12:05 nicolab28