Sign in to follow this  
interdpth

Apply HSL to a current scene

Recommended Posts

interdpth    100
Hi, I need to know how to apply HSL to a current scene, I have my values, but no clue how to apply them, nor can I find example code that doesn't use those shaders, which I have no clue about how to use, so can I get some help?

Share this post


Link to post
Share on other sites
Yann L    1802
Uhm ?

I assume with HSL you mean the colourspace. What do you want to do with that colourspace ? What do you mean by "apply" ? Do you want to apply a colour space conversion to a render target ?

Share this post


Link to post
Share on other sites
Yann L    1802
I'm afraid you have to be a little more precise about what you want to do in order for anyone to be able to help you. We can't read your mind, you know.

OK, I'll take a stab into the dark. I assume you want to apply some kind of HSL transform to some kind of render target. You render a full screen quad over the screen, with your original image bound as texture, and some empty target to receive the result. You render this quad with a shader that will transform the source pixel to HSL, apply the transform you want, and convert it back to RGB.

That's about as precise one can get without you giving us much more info.

Share this post


Link to post
Share on other sites
interdpth    100
Alright, alright

I have http://i83.photobucket.com/albums/j318/interdpth/NEEDSMATERIALS.png that picture.

I have all the values needed to turn those into http://i83.photobucket.com/albums/j318/interdpth/test.png

But I don't know how to code it.


Share this post


Link to post
Share on other sites
Yann L    1802
Ok, sorry, I have absolutely no idea what you want. Maybe someone else (with telepathic abilities ;) can guess.

The first image is a 3D model without any lighting or effects. The second one is the model rendered with lighting, a reflection envmap, fog and some other postprocessing effects like bloom. All this has nothing to do with HSL conversion or any "values".

Edit: are you asking how to get the render quality of the second image with just your first model as start ? How much experience do you have with graphics programming ? Do you know what all the effects I mentioned above are ? Do you know what shaders are ?

Share this post


Link to post
Share on other sites
BlackSeeds    156
Quote:
Original post by Yann L
Ok, sorry, I have absolutely no idea what you want. Maybe someone else (with telepathic abilities ;) can guess.

The first image is a 3D model without any lighting or effects. The second one is the model rendered with lighting, a reflection envmap, fog and some other postprocessing effects like bloom. All this has nothing to do with HSL conversion or any "values".

Edit: are you asking how to get the render quality of the second image with just your first model as start ? How much experience do you have with graphics programming ? Do you know what all the effects I mentioned above are ? Do you know what shaders are ?


lol agreed, I thought maybe he means HLSL? insert HLSL code to turn image 1 into image 2 by some magic code?

Share this post


Link to post
Share on other sites
Yann L    1802
Quote:
Original post by BlackSeeds
lol agreed, I thought maybe he means HLSL?

In the OpenGL forum ?

Even if the OP means HLSL, it takes a little more than a magic (read: copy'n'pasted) shader to turn pic1 into pic2 :)

Share this post


Link to post
Share on other sites
interdpth    100
By HSL, I mean the Hue, Saturation and Luminescence of an image, sorry. The first model I linked to has none of these. While the second one does, I have all the data it takes to make the second, with the HSL values(see above if confused) but I don't know how to apply them. I honestly have no clue to apply shaders to my program and such, just hoping for a semi-simple example

Share this post


Link to post
Share on other sites
Yann L    1802
Quote:
Original post by interdpth
By HSL, I mean the Hue, Saturation and Luminescence of an image, sorry. The first model I linked to has none of these. While the second one does, I have all the data it takes to make the second, with the HSL values(see above if confused) but I don't know how to apply them. I honestly have no clue to apply shaders to my program and such, just hoping for a semi-simple example

Oh, now I understand :) A NeHe victim :)

Well, sorry to burst your bubble, but that's not how 3D graphics work. You cannot just apply some HSL "values" to a model in order to render it the way it looks in pic2.

The second picture is generated by applying a whole set of more or less complex mathematical equations and algorithms onto the model. This is much, much more complicated than just some HSL conversion. In fact, HSL has nothing at all to do with it. You will have to do per-pixel lighting from multiple light sources, possibly shadow mapping and ambient occlusion, reflection mapping, probably normal mapping, and image space postprocessing. This is complex stuff. You can't do that by simply copy and pasting some magical code or "values" into it. There is a lot of math behind this, and you have to understand all of it in order to do something like that.

You need to learn about linear algebra, understand vectors, matrices, coordinate frames and transformations. You need to learn about how shaders work. And then you need to apply this knowledge to add one effect after another. If you are starting from zero, then getting an image as the one in pic2 will take you considerable time. There is no simple way.

Or maybe consider using a third party 3D engine such as Ogre. That will save you a lot of time.

Quote:

By HSL, I mean the Hue, Saturation and Luminescence of an image, sorry. The first model I linked to has none of these.

Just a quick note. You misunderstood what HSL means. HSL is a colourspace. It's a mathematical way to encode a tristimulus colour, much like RGB, YUV and the like. Every visible image, including your pic1, can be encoded as HSL. It's just another way to represent a colour.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this