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 / Shader 'removes' .dbo lightmap?

Author
Message
GeeBee
17
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 23rd Dec 2010 14:58
See attached.

The terrain is a set of .dbo objects with lightmaps. When the greyscale shader is applied the lightmap shadows disappear (which is fine for my use, albeit unintended).

When I remove the shader I cannot get the lightmap back.

I am using .dbo format for simplicity as the related lightmap loads with the object.

Is it the shader (not my strong point...)or something else?



Habits can get you into trouble sometimes (unless you are a nun....)
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Dec 2010 00:38
Quote: "When the greyscale shader is applied the lightmap shadows disappear (which is fine for my use, albeit unintended)."


That's because the shader only uses the first texture stage, i.e. stage 0. I guess the lightmap is on stage 1 which isn't used in that shader. Is this any better?



I don't think your method of removing the shader will work on its own - you also need to reinstate the blendmapping used for the lightmaps. A simple solution is to add a second technique to your shader which will do the blending for you. If you're stuck I'll look at this for you tomorrow.
GeeBee
17
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 24th Dec 2010 11:01
GG - nope, no change.

I tried a similar approach but couldn't get the LM stage to 'map' correctly (see adapted Blend shader from DarkShader). If you're willing to help that would be great.

Presumeably you're suggesting one technique to blend normally and another to do the greyscale when required. Or two shaders and swop between them? (for info, it's a 'thermal camera' representation I am doing).

In the meantime, I've also explored loading a duplicate set of resources using the current shader, which are swopped (hidden & excluded) until required. Seems to work but not sure of wider implications yet.



Habits can get you into trouble sometimes (unless you are a nun....)
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Dec 2010 12:33 Edited at: 24th Dec 2010 12:34
Quote: "GG - nope, no change"


Works fine for me - I get the shadows with the greyscale shader. What do you get? A screenshot would help. Here's a comparison:



You should still have the problem removing the shader though.

Quote: "Presumeably you're suggesting one technique to blend normally and another to do the greyscale when required."


Yes.
GeeBee
17
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 29th Dec 2010 00:21
GG

Quote: "Works fine for me "


After correcting (my) errors, you are of course correct.

I have implemented two techniques as suggested which seem to work, but I now get 'dark lines' at a distance once the shader is implemented.

Revised code & resources attached.

Habits can get you into trouble sometimes (unless you are a nun....)
GeeBee
17
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 29th Dec 2010 09:08 Edited at: 29th Dec 2010 09:11
Screenshot of the 'dark lines' or seams.



Habits can get you into trouble sometimes (unless you are a nun....)
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Dec 2010 12:33 Edited at: 29th Dec 2010 12:34
A quick question. Do you mean the red lines or the purple ones? I'll look at your demo later today.

GeeBee
17
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 29th Dec 2010 15:11
The red ones.

The purple one is a "track/road" drawn onto the texture.

Habits can get you into trouble sometimes (unless you are a nun....)
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Dec 2010 15:20
Thought so. Thanks.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Dec 2010 17:45 Edited at: 29th Dec 2010 17:46
I think the solution is simple. In the lightmap sampler part of
the "BlendAndGreyscale.fx" shader change this line



to this



I realised what the problem probably was as soon as I looked at some of your lightmaps. Here's a typical example:



If you allow mipmapping then the black borders start to get averaged with the neighbouring pixels so you start to see black seams when the texture lookup occurs.
GeeBee
17
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 29th Dec 2010 18:26
Sorted!!

Thank you

Habits can get you into trouble sometimes (unless you are a nun....)

Login to post a reply

Server time is: 2026-07-18 07:33:05
Your offset time is: 2026-07-18 07:33:05