hanatos / corona-13

cpu path tracing test bed
GNU General Public License v3.0
42 stars 1 forks source link

Instances? #2

Open ib00 opened 2 years ago

ib00 commented 2 years ago

Is there any way to have instances?

It looks like that primitive index supports different primitives (spheres, lines, triangles), but is there a way to encode transformation matrix?

hanatos commented 2 years ago

it totally doesn't instance in core because that's cheating. i suppose it wouldn't be hard to put there as a primitive type, but i always rendered de-instanced:

instances

ib00 commented 2 years ago

Sure, it's easy to replicate geometry.

But, if you added instancing, would the easiest way be just to add transformation matrices to 'prims_shape_t' struct?

hanatos commented 2 years ago

the .geo format is an out-of-core format. it is just memory mapped into the brain of the renderer. as such, the only thing that remains to load into the heap is a global index array. in particular that means the shape struct is on disk once for each shape and you don't want to put instance matrices into these.

i suppose the way to do it would be introduce a new geo type (spheres lines triangles quads..) that doesn't hold vertex data but a transformation matrix + instance id instead.