GLSL vertex and fragment programs

Everything related to the code /
Tout ce qui touche au code
Post Reply
User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

GLSL vertex and fragment programs

Post by zuzuf » Sat Jul 26, 2008 3:43 pm

they are now fully supported by the 3DM format, it can handle saving and loading GLSL programs. This is not new, but now you can really use those GLSL programs since you have a GLSL code editor within 3DMEditor, so you can edit/create GLSL programs for your objects. Also it now renders using the given shader when there is one (this was missing) and set some variables of GLSL programs to various textures ID.

If you want to use a texture in your GLSL code, you need to declare a sampler2D called tex* where * is the number of the texture it refers to (from 0 to 7 max). * corresponds to the textures in 3DMEditor.

So now we can add nice effects to our models like bump mapping or simulated geometry, etc ... but keep in mind that the more feature you use the less computers will be able to run them. So make sure it still looks good when shaders are not available.
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Sat Jul 26, 2008 6:38 pm

Maybe some example, if it is not too long to make one? :D

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sat Jul 26, 2008 11:57 pm

I made a small sphere with a normal map and a small shader:
Image

you can download the object here :
http://www.ta3d.org/files/examples/sphere.3dm

NB: I didn't compress the textures, normal maps don't really like JPEG ...

PS: you'll need current SVN version of 3DMEditor in order to have shader effects ... they were disabled in previous releases :P
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Sun Jul 27, 2008 4:56 am

WOW! :shock: Looks very nice :) Can you build 3dmeditor so I could look deeper into it?

I suppose that metal deposits with shader effect will be really cute :twisted:

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun Jul 27, 2008 7:10 am

I am not really fond of using shaders for metal deposits ... they are basic things on the map, and you can have lots of those to draw on the screen which will slow down rendering ...

and metal deposits are a "critical" component of a map, so we need it to be compatible with older hardware. But if you can make a shader that can be disabled without hurting visual quality, then ok :)

There is one thing you must keep in mind :
the GLSL shader will take over the whole rendering pipeline, which means you'll have to implement lighting, fog, texturing, etc ... and if you use "odd" textures like normal maps, then disabling the shader will render those textures on the object which will make them look strange :)

I'll build a package with current SVN, so you can test the new stuffs ;)
=>;-D Penguin Powered

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sun Jul 27, 2008 10:46 am

done :D
=>;-D Penguin Powered

User avatar
Balthazar
Moderator
Posts: 2055
Joined: Wed Nov 01, 2006 4:31 pm
Location: Russian Federation
Contact:

Post by Balthazar » Sun Jul 27, 2008 4:23 pm

Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests