46
General discussions / Re: Verifying Claims Made in an Article : SFML Cannot Do 3D?
« on: January 24, 2022, 10:45:01 am »
I've managed to render 3D models using the SFML graphics module with some shader trickery, and by forcing normal/depth data into the colour property of sf::VertexArray - and made a couple of games with that technique:
https://fallahn.itch.io/did
and
https://fallahn.itch.io/purcitop-garden
The gist of it is to replace the model/view/projection matrices with your own in a custom vertex shader, and to store the normal vector in the vertex RGB channel, and vertex z-depth as a normalised value in the vertex alpha channel. It kinda works, although to be honest the amount of OpenGL you need to learn to understand how SFML works under the hood means it's probably not worth the effort (other than the learning exercise) and I should probably just use OpenGL directly for the performance gain
If you're curious source is available here: https://github.com/fallahn/osgc/tree/master/did and here https://github.com/fallahn/osgc/tree/master/lightmapper for a model format converter I made to go with it (yes, I even went as far as to create a specific model format...)
https://fallahn.itch.io/did
and
https://fallahn.itch.io/purcitop-garden
The gist of it is to replace the model/view/projection matrices with your own in a custom vertex shader, and to store the normal vector in the vertex RGB channel, and vertex z-depth as a normalised value in the vertex alpha channel. It kinda works, although to be honest the amount of OpenGL you need to learn to understand how SFML works under the hood means it's probably not worth the effort (other than the learning exercise) and I should probably just use OpenGL directly for the performance gain
If you're curious source is available here: https://github.com/fallahn/osgc/tree/master/did and here https://github.com/fallahn/osgc/tree/master/lightmapper for a model format converter I made to go with it (yes, I even went as far as to create a specific model format...)