zeux / niagara

A Vulkan renderer written from scratch on stream
MIT License
1.26k stars 72 forks source link

Adding simple fps camera #12

Closed firesgc closed 4 years ago

firesgc commented 4 years ago

Hello,

I have added a simple first person camera to the project (at least the logical part of it). The culling doesn't work with it anymore, and to be honest, I don't really understand how the culling works in the compute shader:) Probably the view matrix should be imported into the shader together with the culling data and all local models position should be transformed. Or is there an easier/better way?

Cheers,

zeux commented 4 years ago

Yeah, I would suggest adding a view matrix and transforming culling data and vertex data with that matrix. The culling logic right now is optimized to assume that it can work in camera space (with world and camera space being one and the same), it's easier to maintain that.

The shaderFloat16 problem is same as #10, makes sense to disable that - feel free to submit that separately if you want so that it can be merged quickly.

firesgc commented 4 years ago

I have added the view matrix to the shaders, and now it works as intended (it looks intresting to see the clipping frustum when you disable ln90 in drawcull.comp.shader). If the changes do not make it into the main line (eg: it doesnt make sense to keep it) it was a nice exercise at least :)

Thank you for your support.