Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Tint texture with normal mapping?

Author
Message
TuPP3
19
Years of Service
User Offline
Joined: 26th Jan 2007
Location: [+--]FINLAND
Posted: 5th Feb 2012 11:42
What would be the easiest way to tint object, while maintaining the texture? Shaders?
Intrenal commands(set emissive, specular etc.) don't work with object that has effect applied.

This would be applied to every object, so it should be a fast technique. I also have normal mapping on every object, so if it's a shader solution, then I'd need some help to combine shaders(I've tried it, but I can't figure that HLSL out).
There's
float3 LightColor={1.0f,1.0f,1.0f};
in Evolved normal mapping shader, but that will only change the light color, and doesn't give the full tint effect that I'm after.

Like in Super Mario Bros you have the green/blue/white pipes. I really don't want to remake textures for every color, that would pretty much triple the texture amount.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 5th Feb 2012 12:31
Quote: "What would be the easiest way to tint object, while maintaining the texture? Shaders?"


Quote: "I also have normal mapping on every object, so if it's a shader solution"


Since you are already using shaders then the simplest solution would be to modify the shader. Post the shader code here and explain what you mean by "tint" and the fix should be simple. I'm sure someone will be able to do this for you.
TuPP3
19
Years of Service
User Offline
Joined: 26th Jan 2007
Location: [+--]FINLAND
Posted: 5th Feb 2012 13:21
It's the Evolved's Normal mapping shader:


By tinting I mean changing the color while maintaining the basic texture, such as overlaying color on it.
Like this:


I could do that very easily on Photoshop, but that would require own texture file for just each color.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Feb 2012 15:17 Edited at: 5th Feb 2012 15:29
There is a tinting command built into DBPro.

SET object DIFFUSE

I tried it out last week, and it can be used to tint objects.

Edit: Sorry, just remembered that I was trying it out on a sprite (SET sprite DIFFUSE), but it should work with an object too.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Feb 2012 01:15
Try something like this:

In the second "UN-TWEAKS" section (actually that should be the "TWEAKS" section ) add an extra declaration so it reads



and change this line in the pixel shader code



to



You can change the value of "tint" in the usual way from DBPro using set effect constant vector (you can set the fourth value of the vector to zero - it won't be used).
TuPP3
19
Years of Service
User Offline
Joined: 26th Jan 2007
Location: [+--]FINLAND
Posted: 8th Feb 2012 18:15 Edited at: 8th Feb 2012 18:16
Thank you very much Green Gandalf, your awesome!

I try somewhat to understand this shader language, but I can't really make sense how it works. It can produce some really cool effects just with the colors.

It has still somewhat of different color light feeling instead of real color, but I still have to fiddle with the settings some more and try the resoults.

Sorry about late bump, but I really want to thank you for the help!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th Feb 2012 19:13
You're welcome.

That was just a quick fix to test the water. The change I posted could probably be improved by additive rather than multiplicative blending or something similar. Anyway, experiment a bit and when you've got a clear idea of the sort of change you want just post back and I'll take another look.

Login to post a reply

Server time is: 2026-07-11 02:55:51
Your offset time is: 2026-07-11 02:55:51