first of all, this is my first post, i made several programs with PB already, but never did something with the 3D engine.
iam not new when it comes to 3D, made my own procedural city in another engine. and have experience with Sketchup, C4D and a little bit of Blender.
never used shaders before, iam completely new to this.
but now the question(s):
i have in Sketchup an ogre mesh exporter which works perfectly. but what i dont get is the steps involved to apply a shader on that mesh.
can it be done in PB itself or need i software for that? i already searched the internet for answers.
i found out that you have for example a *.mesh thats linked with an *.material in that *.material you can link to an *.hlsl (and other shader types?).
but now i need to know, what are the steps involved to apply a shader to that mesh?
and what steps / software do you use to make this happen?
feedback is appreciated.
how to apply shader on ogre mesh?
Re: how to apply shader on ogre mesh?
Hello T4r4ntul4,
Welcome to the Purebasic forums.
There is also CG shaders which can be used for both DirectX and OpenGL, but they require an external DLL to run.
Before learning about shaders I'd first recommend you learn the material script syntax.
Ogre's material scripts
Once you have the hang of using material scripts adding shaders is pretty easy. Well, not always depending on the shader.
Here are some shaders that have appeared on Purebasic's forums.
It might pay to take a look through them.
PerPixel Shading
Toon Shading
Fresnel Shading
Ocean Shader
Compositor examples
Edit:
I reread your post and noticed you said your new to shaders.
Learning material scripts is definitely a good place to start. Material scripts can be created in any text editor.
Just save it as a .material file and load it in Purebasic with GetScriptMaterial(#Material, Name$).
If you have any questions even small ones don't hesitate to ask.
Welcome to the Purebasic forums.
Yes, this is the basic principle for all shaders in Purebasic. You can use HLSL shaders for DirectX and GLSL shaders for OpenGL.T4r4ntul4 wrote: i found out that you have for example a *.mesh thats linked with an *.material in that *.material you can link to an *.hlsl (and other shader types?).
There is also CG shaders which can be used for both DirectX and OpenGL, but they require an external DLL to run.
I'm not sure how familiar you are with shaders so this is a tough question to answer.T4r4ntul4 wrote: but now i need to know, what are the steps involved to apply a shader to that mesh?
and what steps / software do you use to make this happen?
Before learning about shaders I'd first recommend you learn the material script syntax.
Ogre's material scripts
Once you have the hang of using material scripts adding shaders is pretty easy. Well, not always depending on the shader.
Here are some shaders that have appeared on Purebasic's forums.
It might pay to take a look through them.
PerPixel Shading
Toon Shading
Fresnel Shading
Ocean Shader
Compositor examples
Edit:
I reread your post and noticed you said your new to shaders.
Learning material scripts is definitely a good place to start. Material scripts can be created in any text editor.
Just save it as a .material file and load it in Purebasic with GetScriptMaterial(#Material, Name$).
If you have any questions even small ones don't hesitate to ask.
Re: how to apply shader on ogre mesh?
thank you for your reply!
thats some stuff i need to look into.
i saw that with CG shader that you need Nvidia's cg toolkit, but if i use that shader in my software does the user needs that also installed on their pc?
what is the common use with PB, HLSL or GLSL?
btw, ocean shader link, the zip is not there anymore.
if iam looking through the NVIDIA Shader Library, and i choose an HLSL shader, then i get a *.fx file do i need to renema the extionson to *.hlsl ?
iam gonna experiment with the new info.
thats some stuff i need to look into.
i saw that with CG shader that you need Nvidia's cg toolkit, but if i use that shader in my software does the user needs that also installed on their pc?
what is the common use with PB, HLSL or GLSL?
btw, ocean shader link, the zip is not there anymore.
if iam looking through the NVIDIA Shader Library, and i choose an HLSL shader, then i get a *.fx file do i need to renema the extionson to *.hlsl ?
iam gonna experiment with the new info.
Re: how to apply shader on ogre mesh?
You just need to include the cg.dll with your software then the end user won't have to download the whole cg toolkit.i saw that with CG shader that you need Nvidia's cg toolkit, but if i use that shader in my software does the user needs that also installed on their pc?
If you use CG then make sure you use InitEngine3D(#PB_Engine3D_EnableCG) otherwise CG shaders will not work in Purebasic.
They are both used, but it really depends on what platforms your building the software for.what is the common use with PB, HLSL or GLSL?
OpenGL shaders will work on all three platforms whereas DirectX shaders will only work on Windows.
If your only targeting Windows then I'd use HLSL, but GLSL isn't a bad choice. Whatever one is easier for you to understand is probably the best choice.
I think I still have it somewhere on my computer. So, if idle no longer has the ocean shader. I'll upload it in his topic when I get some spare time.btw, ocean shader link, the zip is not there anymore.
I believe so, but in order to get it to work. You need to build a material script that will send all the required information to the shader.if iam looking through the NVIDIA Shader Library, and i choose an HLSL shader, then i get a *.fx file do i need to renema the extionson to *.hlsl ?
Shaders and material scripts can be hard to debug. So, it's a good idea to use InitEngine3D(#PB_Engine3D_DebugLog) which will report
the errors it can find in an Ogre text file. The text file will be made wherever your program is located.
