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 / [STICKY] Learning to write Shaders

Author
Message
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 10th Dec 2006 18:48 Edited at: 10th Dec 2006 18:55
Alright, this is just taking the code from Evolved's shader with my files in there instead:



Here's the media as well:
http://www.tornupgaming.com/Portfolio/DarkBasic/flashlightissue.zip

It's all there, and since the exact same problem comes up in my own code as the "official code" if you will, then it's got to be a problem with files.

Sorry about getting everything mixed up and thanks again haha!

www.tornupgaming.com
The home of free games and game projects.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Dec 2006 19:22 Edited at: 10th Dec 2006 19:39
@Terrorist Zero

OK, got the files. I've just run your snippet and - er, yes, there's something very wrong. Before I go much further could you check that the attached screenshot is similar to what you get?

[I tried your demo game program by the way - I can see why you want a flashlight ]

Edit: Making some progress. I'm sure your problem is connected with the fact that you're ghosting one object on another (I realise Evolved used that method). You may be getting something called "z-fighting" between the two objects - or perhaps the normals are wrong? It might be better to work with one object and apply all the lighting and textures to that - but it would mean changing the shader quite a bit. I'll try a few other things in the meantime.

Attachments

Login to view attachments
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 10th Dec 2006 20:07
Yeah that's what's going wrong.
I've got a feeling it's to do with the map files themselves, but you never know when you do programming

www.tornupgaming.com
The home of free games and game projects.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Dec 2006 20:54 Edited at: 10th Dec 2006 21:23
@Terrorist Zero

Don't get too excited yet - but I have an idea. Just got a few extra tests to do ...

Edit: Here's my first working attempt (see attached screenshot). Quite a tricky one this. Lighting needs tweaking - but you have a flashlight and your textures (not thoroughly checked though).

Is it worth me continuing?

2nd edit: Further tests may have to wait till after I've eaten - appetising aromas are emanating from the kitchen.

Attachments

Login to view attachments
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 10th Dec 2006 22:03 Edited at: 10th Dec 2006 22:04
Haha,you go eat GG!

Is there no way to get the lightmapping as it was again? Or is that what you're on about with tweaking the lighting?

Either way it's doing well GG, nice work and thanks!

www.tornupgaming.com
The home of free games and game projects.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 10th Dec 2006 22:04
Where is the fixed Flashlight? I have been searching through this thread for about 15-20 minutes now :S

The byte chrunchers are coming...
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 10th Dec 2006 22:09
Green Gandalf's being a dude and fixing it, so it's not ready yet, just be patient, like me...

Haha, just sit and wait like a good boy.

www.tornupgaming.com
The home of free games and game projects.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 10th Dec 2006 22:11
oh, ok, well, I will wait

The byte chrunchers are coming...
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Dec 2006 23:02 Edited at: 10th Dec 2006 23:37
@Terrorist Zero

OK. Here's my latest attempt. I'm sure it can be improved, but I think we're on the right track now.

Here's the revised DBPro code snippet:



And here's the revised FX code:



I've made so many changes I've lost sight of the critical ones. The main change, I think, is that the code now deals with just one object (.x file). When you run the code the area is initially very dark - so it's hard to tell when it's actually loaded and ready to go. If that's a problem just increase the ambient value in the DBPro code - that's something I added to the code and the shader.

The downside is that I'm sure something has been lost in the lighting - perhaps that's the lightmapping you were referring to? Anyway, now I've sorted out the main problem, we can move on.

I'm sure we can fix the lightmapping - I'd forgotten it was there.

Let me know what you think and if anything is missing, i.e. textures, lightmaps, etc.

In the meantime I'll see if I can find the lightmap you referred to.

Edit: OK, I've found the lightmaps. I completely missed the point of the second object. Sorry. Is there any reason why you can't apply the lightmap to the original object - i.e. have the textures and lightmaps in one place? I can then adjust the shader to read the appropriate texture stage UV coords. All I need to know is the texture stage for the base texture and the stage for the light map - and if you don't know, I can probably work it out (did something similar for Overdroid the other day).
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 10th Dec 2006 23:59
This is going really well, I'll try out the new code in a minute!

I'm uploading a zipped up .dbo file that includes all textures and lightmaps in the same file if that helps. That's at:
http://www.tornupgaming.com/Portfolio/DarkBasic/fullmap001.zip

I'm pretty sure that stage 0 is the base and stage 1 is lightmap, but it's just a case of trial and improvement, which to be honest is the best way to do anything (unless you're told exactly how to do something ).

www.tornupgaming.com
The home of free games and game projects.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2006 00:19
Thanks, I'll download now - but I won't be able to do anything till tomorrow. Having everything in the same object should make a big difference. It's possible that Evolved's shader was trying to stay within the constraints of PS1.4 - I'll be using PS2.0, hope that's OK.
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 11th Dec 2006 00:35
Perfectly fine, I'm running a GeForce FX5200 meaning 2.0+, and I'm upgrading pretty soon anyway (Prays for an 8800 for xmas with 4.0 support ).

www.tornupgaming.com
The home of free games and game projects.
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 11th Dec 2006 09:42
@Terrorist Zero

I did fix this at one point (using a .dbo with base+lightmap on a single object). Iv uploaded it again with your map file, and you can get it here > http://www.vector3r.com/flashlight.zip

Should work
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2006 10:02
@Evolved

Thank you. Apart from minor details, that was exactly what I was hoping to do for Terrorist Zero. I'm sure he and others will find that new version very useful.
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 11th Dec 2006 21:33
Hey GG, I've still got alpha problems...

I think it's possible to only write to the zbuffer if the alpha is above a certain level?

Do you know anything about that?

I saw it in some doc I think, I can't really remember...

-= Out here in the fields, I fight for my meals =-
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Dec 2006 22:13 Edited at: 12th Dec 2006 10:15
Quote: "Hey GG, I've still got alpha problems..."


So have I.

Yes, I've seen it too - probably in one of those opaque DX9 SDK docs. But I couldn't make any sense of how to use it. Something to do with alphatesting I think. All we need is a simple example.

I must confess I don't see why it should be so difficult to blend each polygon with the things already rendered behind it. For example, if you merely want to blend by adding why should the order matter? For some inexplicable reason that simple task escapes me - I can do it for some objects and some polys but not consistently for all of them simultaneously. I feel sure there must be a simple render state or set of states which does all this.

[Edit: I think I posted the above before engaging brain first - will have another look at this when I get home tonight. I'm sure I had something working along those lines once ... ]
Terrorist Zero
18
Years of Service
User Offline
Joined: 29th Aug 2006
Location: Teh YouKai
Posted: 12th Dec 2006 18:15
Hey hey, Evolved you legend!!
Works really really well.

One problem is that it makes the lightmaps brighter than they should be so it kinda makes little difference in some places. I've tried adjusting ambient light, and darkening the lightmap itself in 3D World Studio, and it's the same. Looking at the shader and tweaking doesn't help either. Any clues?

www.tornupgaming.com
The home of free games and game projects.
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 12th Dec 2006 21:22
Open up the shader and get rid of this bit "LightM=LightM+LightM+LightM+LightM;" or put it to "LightM+LightM;". I put that bit in cus your map was so dark I could not any thing, and my monitors on full brightness etc.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Dec 2006 21:26
@Terrorist Zero

The problem should be easy to fix. If Evolved hasn't offered any suggestions in 24 hours time I'll have a go. In the meantime you might like to think about the following two lines in the shader:



and ask yourself the question "why did Evolved do that?". You might also find it helpful to add a new variable called "ambient" which will help you adjust the ambient level as I did in my first attempt. But there might be an unexpected difficulty ...

Can you wait 24 hours?
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 12th Dec 2006 22:25 Edited at: 12th Dec 2006 22:27
Got there just secs before of you GG :p

@Terrorist Zero

Quick up date to that flashlight shader, Iv tried your Station 13 demo and looks like the gun need to flash light on the lightmap too. So I added some dynamic lights to the shader for that sort of thing. Hit/tap the space bar to see the light flash, Get it here > http://www.vector3r.com/flashlight2.zip

Just call the "Set_DynamicLight(x,y,z,r,g,b,range)" function every time you want a Dynamic Light (Note: you have to call it each loop for lights with longer life). And call "Update_DynamicLights()" Function before the loop ends, hope it helps.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Dec 2006 22:48
@Evolved

Welcome back! Your shaders are being used a lot here - so any input is much appreciated.

Also, most of us are newcomers to shaders so we tend to flounder a bit from time to time. I've tried to help a few people, with varying degrees of success, so additional help from someone with more experience would be very welcome.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Dec 2006 22:53 Edited at: 12th Dec 2006 22:55
@Chris K

Quote: "Hey GG, I've still got alpha problems...

I think it's possible to only write to the zbuffer if the alpha is above a certain level?

Do you know anything about that?

I saw it in some doc I think, I can't really remember...
"


Have a look at the following link suggested by Paul Johnston. It contains lots of useful info on all sorts of things including alpha testing (trying some of the things tonight - I've temporarily gone into learning mode again):

http://www.toymaker.info/Games/html/render_states.html

Edited link to look like a link!
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 13th Dec 2006 12:44
I fixed it, but that is simply an invaluble link!

-= Out here in the fields, I fight for my meals =-
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 14th Dec 2006 15:39
Quote: "How's that coming along?"

Well, to tell you the truth i was hoping it would be simple enough that you'd be able to whip it up in a jiffy, but it doesn't look like it is. So i'll have to actually put some work into it (oh my! )

The reason i've had no progress/time lately is because of finals, but i finished my last yesterday. So i have time coming out my ears now, yay!

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Dec 2006 19:19
@Peter H

Quote: "Well, to tell you the truth i was hoping it would be simple enough that you'd be able to whip it up in a jiffy, but it doesn't look like it is."


Actually, that was why I asked. My brain needs a temporary break from mind-numbing problems with normals, bumpmaps, lightmaps and texture stages so I thought I'd see how you were getting on. I wonder what you want exactly though? On your WIP thread you say you can already make the hog's eyes turn red. What more do you want the shader to do exactly? Give me a clue and I'll give it a go.
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 14th Dec 2006 19:53 Edited at: 14th Dec 2006 19:54
Sweet! thanks for the help.

right now I'm not using a shader to make their eyes red. I just texture them with a texture that has red eyes.

the problem is is that it's not very obvious their eyes are red. i was thinking something along the lines of bloom in the sense that the color "bleeds" past the edges of the actual object. This could be applied so that the eyes glowed red, like a little light right at their eyes.

or another idea would be to have the entire object glow (just around the edges, so the actual object wouldn't turn red, but would form a red outline)

part of the problem is that i don't know what would be easy to do with a shader and what would be insanely difficult. so I'm very open to suggestions/altercations.

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Dec 2006 20:24
OK, here's my first attempt (didn't see your latest post till now so I know it isn't exactly what you want - but you can tell me if I'm on the right track).

Attachments

Login to view attachments
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 14th Dec 2006 20:28
Thanks for trying! that would work if the hogs were very large (or in a cut scene) but i think it's going to have to be something largely exaggerated for it to be noticed at all...

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Dec 2006 21:29
You can make the eyes as large as you like. All I did was make two copies of the "hog's" skin - one with black "eyes" and the other with red - and then blended the two images according to the value of "glow#". I assumed you would use your own images.

Your suggestion of using something like a bloom shader might work - but you need to be careful you don't end up blurring the whole animal. It might also need several passes so would be rather slow.

Quote: "or another idea would be to have the entire object glow (just around the edges, so the actual object wouldn't turn red, but would form a red outline)
"


Did you see the glow shader I posted a while back? All you would need to do is change the glow colour. Here's a screenshot.

Attachments

Login to view attachments
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 14th Dec 2006 21:38
oh, ok! didn't see it before. took me awhile to find it but i did, i'll have a look at it when i have some time (in an hour or two it looks like)

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Dec 2006 23:44
@Peter H

It would be easy to combine the earlier glow effect with the red eye glow effect I posted today. But it will have to wait till tomorrow...

... unless Evolved jumps in before me.
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 15th Dec 2006 01:06
hmm, ran into a problem with the glow shader...

with the code as it is i get this

I tried tweaking the glow width but it didn't help

it seems like my card doesn't support that high of a shader level for some odd reason... it's supported every single other shader i've run on it. when i don't apply the shader i get the spheres with their normal texture, but when i do it makes then white like that...

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Dec 2006 11:42
@Peter H

Sorry you're having problems with the shader. I don't have DBP available here at work so I can't check till later. It's just possible that I made a mistake with the uploaded file, so I'll check that when I get home later (but no-one else has reported problems - but then you might be the first to try it ).

In the meantime could you check your system to find out the MAXIMUM VERTEX SHADER VERSION and MAXIMUM PIXEL SHADER VERSION? I'm not sure of the syntax of the DBP command - but you should find it easily enough in the Help index. Once you've found that out I might be able to fix the shader if that's necessary. I usually compile my shaders using PS2.0 - but they often work with earlier versions as well. I've usually been too lazy to check.

It's also possible the image files are in the wrong place. Anyway, I'm sure we can sort something out later today. But find out what your system supports first.
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 15th Dec 2006 15:05 Edited at: 15th Dec 2006 15:05
sure,
i get 3 for vertex and 2 for pixel with this code:


what's odd is that I've run other pixel shaders using PS2.0 (at least, i'm 99.99% sure i have). but it's acting like it did on my old computer (with a geforce mx 420 ) just turning the object white.

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Dec 2006 15:39 Edited at: 15th Dec 2006 15:42
Strange. I've just downloaded the file and looked at the code. I can't see any obvious problems. I've used VS2 and PS2 in the reflection shader (for the background scene) and VS1.1 and PS2 in the glow shader - so they should both be OK. From your screenshot it's the glow that doesn't work which is odd.

In the glow shader code, try changing, in two places (*)



to



and see what happens. (I can't test this myself till I get home.)

[Edit: added minor correction (*).]
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 15th Dec 2006 15:44 Edited at: 15th Dec 2006 16:22
hey! it worked!

well, thanks! i'll start tweaking it for my use now

[edit] worked nicely! my only problem is that it gets rid of the lighting on the object... so the mad ones are a ton brighter overall, i don't know if that's easy to change or not though

One man, one lawnmower, plenty of angry groundhogs.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 15th Dec 2006 19:03
I thought I had a bug in my code. I couldn't get any of my objects to 'fade out' using SET ALPHA MAPPING ON. I was very confused and couldn't figure out the problem at all, until I turned off all my shaders. Then the code worked as I expected.
It seems that an object can't use Alpha mapping if it has a shader applied. Or am I wrong? Maybe one of you shader geniuses knows of a way to do it?

EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 15th Dec 2006 20:33 Edited at: 15th Dec 2006 20:35
@Scraggle

Your best bet would be to use the alpha channel with in the shader.

Put this bit in the tweaks:



Chang this bit in the Pixel Shader:



Also set the transparency flag to 1 ("set object transparency obj,1") Once you have loaded it.

Quick example, slight edit to the Environment Bump Mapping shader here



You can re download all my shades here, should be very easy to add in .
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 15th Dec 2006 21:18 Edited at: 15th Dec 2006 21:31
Thanks Evolved!

I still have a problem but at least now there seems to be a solution. The problem I have is that the shader I am most concerned with doesn't seem to have a Pixel Shader section in it.

It's your fur Shader:


I've put the first line in the tweakables but where would I put the second bit?

Thank very much

[Edit] On another note. I have been trying without success to remove shaders from objects. Anybody know how to do that?
The obvious solution would be to use the command SET SHADING OFF but it doesn't work. Below is a test program to demonstrate it not working.


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Dec 2006 21:34 Edited at: 15th Dec 2006 21:39
@Scraggle

Quote: "but where would I put the second bit"


I look forward to seeing the reply. I think Evolved's shader is just relying on the default graphics pipeline plus render states to render the pixels so a pixel shader is not necessary. You may need to add a pixel shader which justs receives the UV coord, looks up the texture and modifies it using Evolved's correction. You may need to adjust the render states as well. There may be a neater solution using render states. Watch this space.

@Peter H

Quote: "worked nicely! my only problem is that it gets rid of the lighting on the object... so the mad ones are a ton brighter overall, i don't know if that's easy to change or not though "


Great! Yes, lighting is one of the difficulties with shaders and you need to include some code in the shader to get it right. (You may be able to use render states to use the already applied lighting - but I don't know if that's possible. Evolved probably knows. Anyway, to answer your question: yes it is fairly easy to change. The easiest is ambient lighting, next comes diffuse directional or point lighting, and finally specular lighting. Would ambient lighting be sufficient for your hogs?

@Scraggle [Edit]

Quote: "On another note. I have been trying without success to remove shaders from objects. Anybody know how to do that?
The obvious solution would be to use the command SET SHADING OFF but it doesn't work. Below is a test program to demonstrate it not working."


I'd like to know the answer too. What I sometimes do is have a hidden second copy of the objects without the shader - and toggle between them as necessary.
EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 15th Dec 2006 21:40 Edited at: 16th Dec 2006 10:03
EDIT!
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Dec 2006 21:51
For those who are watching this "conversation", I overlooked the following bit of Evolved's shader:



and the fact that COLOR0 gets used in the pixel rendering calculations. It's a trick I haven't used - you learn something new every day here.
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 15th Dec 2006 22:01
if by ambient lighting you mean the default light then yes... (or do you mean making the entire object darker, regardless of it's angle towards the light)

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Dec 2006 23:48 Edited at: 24th Dec 2006 18:07
Quote: "if by ambient lighting you mean the default light then yes... (or do you mean making the entire object darker, regardless of it's angle towards the light)"


I meant the latter as in DBPro. (DBPro also has a default directional light - light 0 I think.) I can add other sources if you need them. What do you need exactly?

The attached zip file shows how to include ambient lighting on the object. I've used grey light in the demo - but you can make it any colour you prefer by modifying the DBPro code a bit. I've also cleaned both the FX and DBP code a bit - the original DBP glow code contained lots of unused stuff from another demo of mine and the FX code contained a compensating error.

Edit: See my 24 December 2006 post for a better version.
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 16th Dec 2006 00:07
thank you for the oodles of help you've put in!

If you could work in the default (light 0) directional light, or just have it so you pass the shader a light position, that would be perfect. (whichever is easier)

One man, one lawnmower, plenty of angry groundhogs.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Dec 2006 00:35
Quote: "thank you for the oodles of help you've put in!"


Thanks - but you have prompted me to improve and extend my examples, so we are both winners.

Quote: "If you could work in the default (light 0) directional light, or just have it so you pass the shader a light position, that would be perfect. (whichever is easier)"


OK. But not tonight! Won't have much time this weekend - it's my wife's birthday on Sunday - but if I get a minute ...

AND, there are some neglected queries in the queue (Seppuku Arts, for example, was pleased to be in a queue - but I guess he's not so sure now ).
Peter H
20
Years of Service
User Offline
Joined: 20th Feb 2004
Location: Witness Protection Program
Posted: 16th Dec 2006 01:54
your wife's birthday is more important

+ i have a full two months left

One man, one lawnmower, plenty of angry groundhogs.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 16th Dec 2006 07:39 Edited at: 16th Dec 2006 07:41
@Evolved

I have just tried using your modified Vertex Fur shader but with it applied all my objects are invisible.

This is the code I used to test it:


EVOLVED
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: unknown
Posted: 16th Dec 2006 09:55 Edited at: 16th Dec 2006 09:59
Ok, it didn't work but I re-edited it to use a pixel shader so it should now work .



Remember its not 0-100 but 0.0-1.0 (i.e set alpha in DBp at 50 = 0.5 in the shader).
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 16th Dec 2006 10:12 Edited at: 16th Dec 2006 10:13
Quote: "Remember its not 0-100 but 0.0-1.0 (i.e set alpha in DBp at 50 = 0.5 in the shader)."

I wasn't aware of that. Thanks

The shader now works a treat thank you

Below is a media-less (apart for the shader, of course) bit of code that demonstrates it working. In case anyone else finds it useful.


I don't suppose you know of a way to remove a shader from an object do you?

Login to post a reply

Server time is: 2024-11-23 19:54:06
Your offset time is: 2024-11-23 19:54:06