3D object rendering

#10 ยท closed ยท 1 comments

View on GitHub โ†—

chronos-ctrl

### ๐Ÿ”˜ Request type General feedback ### ๐Ÿ”˜ Description Hello, Is it possible to render a 3d object using ShaderFlow ? I can see from the code that you only consider (x, y) as vertices, also, I don't see any camera projection matrix in the code. So I assume it is only for 2 objects. Correct me if I'm wrong. Best,

Comments

Tremeschin

<div align="justify"> Good question! I'll try to be brief as this eventually will (and should be) in the docs ๐Ÿ˜… We absolutely can render 3D stuff in shaderflow, but not in the "traditional"/blender meshes sense. The scope of the project is rendering a fullscreen rectangle (the two coordinates you noticed) with everything done in a fragment shader (also the reason for the lack of camera matrices, no need in this case) It's _very_ similar to what [shadertoy.com](https://www.shadertoy.com/results?sort=popular) offers, in fact, these most popular demos in the link are often 3d scenes. They use a technique called [ray marching](https://en.wikipedia.org/wiki/Ray_marching), where you mathematically define the scene based on distances to project the rays There's more resources in the [Camera.py](https://github.com/BrokenSource/ShaderFlow/blob/main/ShaderFlow/Modules/Camera.py) file of how the modeling works, but if you run `shaderflow raymarch main` scene* and hit <kbd>3</kbd>, you can walk around with <kbd>WASD</kbd> and the mouse as below (<kbd>Tab</kbd> for dev menu): <sup><i>*: Run [From source](https://brokensrc.dev/get/source/), as I don't bundle demo scenes on pypi/releases)</i></sup> ![image](https://github.com/user-attachments/assets/754da3d9-cf91-4081-b476-a12bb832b783) See how the uniforms pipeline at the left contains the camera position, basis and aux parameters :) Let me know if you have any further question, will move the issue to a discussion!