getting stared with shaders ...

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
bjf
Gnoblar
Posts: 7
Joined: Mon Sep 21, 2020 4:14 am

getting stared with shaders ...

Post by bjf »

I'm trying to create basic vertex and fragment shaders in 2.3 for my large manual objects to do something called "single-pass wireframe rendering".

But I'm missing the very basics of custom shaders on how to integrate them into Ogre. I've been reading through the forum along with some GLSL tutorials and see that the shaders themselves are small separate executable. However, I've not a clue where these executable go in Ogre.

I've also seen some posts where people are creating a custom HLMS to implement shaders, but so far I haven't make the connection between the two. Is a custom HLMS required for doing shaders?

Just for reference, I have HlmsUnlit registered in my app to draw manual wireframe objects.

Can someone speak to this?
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: getting stared with shaders ...

Post by lingfors »

My advice would be to look at HlmsLowLevel if you want to render stuff with your own shaders, it's basically an implementation of the old Material system from Ogre 1, so you can pretty much just look at the documentation from Ogre 1 to figure out how it works. The only thing I noticed was that it doesn't support multi-pass rendering per Material, it will only render the first pass.
bjf
Gnoblar
Posts: 7
Joined: Mon Sep 21, 2020 4:14 am

Re: getting stared with shaders ...

Post by bjf »

If I'm thinking of rendering materials later down the road, would you still recommend this method? From what you're saying, it sounds like if I want materials, I need to not use this HlmsLowLevel.

In the 2.2.4 docs, I see this note in the "Ogre::HlmsLowLevel Class Reference."
This is an HLMS implementation that acts as proxy to use the Material system from Ogre 1.9 The older material system is data-driven (thanks to AutoParamDataSource) compared to HLMS where the user needs to write its own implementation in C++ (or modify an exisiting one).
Which as I understand it means that I need to write a custom HLMS for what I'm trying to do (singlepass wireframe rendering with eventually materials later on). I don't want to have to limit myself to what I can do now and rewrite later. I'd like room to grow.

Or do you strongly recommend still going this route for 2.3?
User avatar
lingfors
Hobgoblin
Posts: 525
Joined: Mon Apr 02, 2007 12:18 am
Location: Sweden
x 79

Re: getting stared with shaders ...

Post by lingfors »

Do you want to get to the interesting stuff (rendering your own shaders) quickly? There is value in quick iteration, especially early on.

And HlmsLowLevel is not that bad:

Image
Post Reply