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
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Apr 2009 19:29
Quote: "OR i totally misunderstood what u meant "


I think you must have done. Could you post the mask maps - or are they the same as before? Are you using the shader I suggested last time?

There's another recent thread on this board where the method was working perfectly:

terrain texture blending

Quote: "For one the color weights are additive."


They are supposed to be.

Quote: "If u have a full red (by full red I mean the maximum red possible = 1/6th of full red) on mask 1 and the same on mask 2 they will show partial textures from each layer BUT will also be brighter like there is light there.
"


Why will they be brighter? Or, brighter than what?

As an extreme example suppose all six textures are the same. Then it doesn't matter what the weights are - if they add up to one for each pixel then it's the same as using just one of the six textures with a full weight of one and the other five weights all zero.
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 28th Apr 2009 18:20
I see now what you mean. It makes sense. I created a small DB program that read the pixel colors of the masks and divided all components by 6. But that was stupid.

If I want one pixel textured with one single texture then I need to have the channel of that texture be full 255 and the other channels 0. If I want to show 2 textures on that same pixel, and if one of the colors is 190 then the other has to be 65, or vice versa. And so on.

But why do you sugest this method? I realize it may be less burden on the processor because it's using multiplication instead of the lerp command. It is more accurate because, if we are true to the rule where the 6 color components total 255 (or 1.0 in shader speak) no texture has priority to draw like in the other method. Hmm i think i may have just convinced my self why u sugest it ^^
What i was getting at is isn't it a lot harder to create mask maps for this? Because with this u need to be carefull not to overlay any color when one of the textures is already 255. But then again, ease of use should be sacrificed for better results.

Take care
AtomR
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Apr 2009 19:40
Quote: "no texture has priority to draw like in the other method. Hmm i think i may have just convinced my self why u sugest it"


Good.

Quote: "What i was getting at is isn't it a lot harder to create mask maps for this?"


Debatable. But I think it is easier to understand that way, especially if you want to blend the textures around the borders between them etc - you can just draw the main colours you want and then blur the mask to give soft boundaries.

However, this is a personal preference - you should do what's easier for you.
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 28th Apr 2009 20:24
OMG how could I have missed your explanation for the light calculations I asked about a few days ago. I was about to ask if u had thought of a way to explain it to me, went back to copy paste the code and there it was ^^ I was probably writing my following post and missed you had posted yourself. And thank you so much. I couldn't have asked for a simpler explanation.

Take care
AtomR
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 5th May 2009 12:14 Edited at: 5th May 2009 12:14
I just started working on my paint shader again. Found out you can read textures from inside the vertex shader in SM3.0 if you use tex2Dlod (tex2D doesn't seem to work).

Anyway, that meant I could move almost all the code into the shader so now it is waaaaay faster. Previously I was making a memblock from a bitmap every frame... very slow.

Here is a pic of just the thin strokes (overlaid on blurred rendering)



Should have a nice demo soon.

-= Out here in the fields, I fight for my meals =-

Attachments

Login to view attachments
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 5th May 2009 15:01 Edited at: 5th May 2009 16:16
Video of a first attempt.
http://www.youtube.com/watch?v=YT97rsylmI0&feature=channel_page

It is going to take a lot of tweaking to get it up to standard, but I think I have done most of the hard work.

It is pretty fast (~250FPS).

--------------

I just textured a plane with some photos to see what it looks like. I need some way of preserving detail without making it jumpy when it moves...



-= Out here in the fields, I fight for my meals =-

Attachments

Login to view attachments
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 5th May 2009 16:43
Beautiful. Good work.

Any chance of sharing the code for learning purposes? Or the thought process that goes into making one of those.

Anyways, I just came here to say that regarding the terrain shader (the one that has been plaguing this thread for the last three or more pages) it hasn't been forgotten. I am happy with it but now i want to learn how to make a point light and have it replace (or add to) the shadowmap. I've been really busy with school work but as soon as I have anything real to show I'll post it.

Take care
AtomR
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 5th May 2009 20:55
I will share the code when it is finished, of course.

It should be pretty easy to use, you just use camera 1 to 'shoot' your game normally, and it 'paints' to camera 0, which is out of the way.

-= Out here in the fields, I fight for my meals =-
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 7th May 2009 16:42 Edited at: 7th May 2009 17:48
In FxComposer 2.5 how can I link/bind a light's position in the render scene to a specific variable in the shader for testing purposes? I want the variable (or should I say shader constant?) to hold the light position as I move it in the scene. Is this possible?

Another thing, for
Quote: "float4 Cam : CameraPosition; "

Cam will always be in World Coordinates unless I convert it to another coordinate system, correct?

[Edit]
Just got home and tested it and the answer to this last question is yes, Cam is in world coordinates.

To reduce the slowdown the normal mapping inflicts on the shader I added an if condition that checks the distance from the "pixel" and the camera. If the distance is smaller then 3000 then use normal mapping, if its bigger then don't use normal mapping. I thought this would drastically reduce slowdown but the truth is it doesn't. Not at all.


Quote: " if(In.lightDist.y<3000){
float4 normal=2*tex2Dgrad(BumpsSample, UV1,DX,DY)-1;
float4 Temp_bump2=2*tex2Dgrad(BumpsSample, UV2,DX,DY)-1;
float4 Temp_bump3=2*tex2Dgrad(BumpsSample, UV3,DX,DY)-1;
float4 Temp_bump4=2*tex2Dgrad(BumpsSample, UV4,DX,DY)-1;
float4 Temp_bump5=2*tex2Dgrad(BumpsSample, UV5,DX,DY)-1;
float4 Temp_bump6=2*tex2Dgrad(BumpsSample, UV6,DX,DY)-1;
normal=lerp(normal, Temp_bump2, Mask1.r);
normal=lerp(normal, Temp_bump3, Mask1.g);
normal=lerp(normal, Temp_bump4, Mask1.b);
normal=lerp(normal, Temp_bump5, Mask2.r);
normal=lerp(normal, Temp_bump6, Mask2.g);

float diffuse = saturate(dot(normal, tempLightDir));
color1=baseColour * diffuse;
}else{
float diffuse = saturate(dot(In.Normal, tempLightDir));
color1=baseColour * diffuse;
}
"

This is the big change I added to the shader. As u can see if the pixel is far away it doesn't sample and create a normal map. But there is no visible increase in performance. Could it be that checking the distance is maintaining the slowdown?

Take care
AtomR
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th May 2009 18:08
Quote: "Could it be that checking the distance is maintaining the slowdown?"


I doubt it. I'm fairly sure early shader versions (and possibly SM3 and 4 as well ) evaluate both halves of a condition in that situation and "lerp" the result. This means there is very little to choose in practice between your two versions.

You could check to see if I'm right by doing something really simple like:



and then take a peek at the asm code that's produced.

The "lerping" uses the result of the condition - i.e. either 0 or 1 - to give the final result.
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 7th May 2009 19:50
Quote: " ps_2_x
dcl v0
mov oC0, v0"

This is the asm of that code snippet you showed. I don't know what it means tho X_X

Take care
AtomR
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th May 2009 22:00
Quote: "I don't know what it means tho "


I do. It means I did (or said) something wrong.

Will check and post back soon - now that I've got a nice machine to play with.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th May 2009 22:47 Edited at: 7th May 2009 22:49
Quote: "Will check and post back soon "


Here's the shader I used with that code snippet:



Here's the pixel shader asm code that Dark Shader gives:



And here is a screenshot showing it working as expected:



I don't know what you did to get such a brief pixel shader output.

Anyway, the important point to note is that both halves of the if are evaluated. That's what the following asm lines do:

[b][/b]


The first two lines define the samplers being used, and the second two read the output of the samplers s0 and s1 into registers r1 and r0 (as you can see - compilers don't think like humans , even though compiler writers might ). This means that both texture assignments are carried out.

The next line:



calculates the difference between the two UV coords and puts the result in the w component of register r2. Then the next:



tests the value of r2.w and if it is negative puts the value of r0 into r0, otherwise it puts the value of r1 into register r0 (it might be the other way round - but the idea is the same).

The final line:



moves the final contents of r0 into colour output register oC0.

This is not quite the "lerp" that I was referring to - but the problem is the same, i.e. both halves of the "if" are evaluated so there is no processing gain. In fact there is a bit of extra processing to do.

Attachments

Login to view attachments
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 8th May 2009 15:00
Weird :S
Does the same thing happen in DBP and other languages? I don't think it does. At least I hope it doesn't.

Thanks GG.

Take care
AtomR
zapakitul
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: In my world
Posted: 8th May 2009 19:07
Hey, i have Evolved Toon shader but i was wondering if i can make it display a white outline instead of a black one :\! Can anyone point me in the right direction?
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 8th May 2009 21:50 Edited at: 8th May 2009 21:51
I'm not sure but seeing as in the edge vertex shader u see



and Edge is declared with the Color0 semantic, I think this line means that the output edge color is 0. Just replace that zero with {r,g,b,a} where r,g,b,a takes floats from 0 to 1.

Take care
AtomR
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 9th May 2009 12:17
From a quick peek, Ill agree with Atom R that this line

Quote: "OUT.Edge.xyzw=0;"


seems to be the bit that decides the outline colour. Perhaps it could simply be set to 1 instead of 0?

zapakitul
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: In my world
Posted: 9th May 2009 13:41
Nop, it's not that one :\
AtomR
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Portugal
Posted: 9th May 2009 14:07 Edited at: 9th May 2009 14:22
Are u sure? I can't get the shader to work on my model. All i get is a black model but when i switch that 0 to 1 i get a white outline.

Maybe that is a coincidence.

[edit]
Here are two more edge colors.
Just replace the
Quote: "
OUT.Edge.xyzw=0;
"

to the two lines you see on the pics.

Take care
AtomR

Attachments

Login to view attachments
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 9th May 2009 14:21
can someone alter this XNA shader to be compatible with DBPro?

http://www.ziggyware.com/readarticle.php?article_id=208



There is always one more imbecile than you counted on.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2009 14:27 Edited at: 9th May 2009 14:28
Quote: "Nop, it's not that one : "


I think you'll find it is as AtomR says.

Quote: "All i get is a black model but when i switch that 0 to 1 i get a white outline."


If your model is black then you obviously won't be able to see a black outline.

Although that line does change the colour it doesn't seem to change it correctly (according to Dark Shader) - some additional shading is going on using the lighting I expect. Also the shader doesn't work correctly on non-welded objects - it separates the polys. There might be a better - and simpler - way of doing the outline. I'll have a think.
zapakitul
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: In my world
Posted: 9th May 2009 14:42
I can't get it to work ;\! Best i did with using float4 color is getting the entire model white. All i need is a shader that adds a white edge on a black model!
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2009 15:28
Quote: "All i need is a shader that adds a white edge on a black model!"


You already have one. Perhaps you are not using it correctly? Post a simple version of the code you are using (with media) and I'm sure someone can fix it for you.
zapakitul
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: In my world
Posted: 9th May 2009 15:39 Edited at: 9th May 2009 15:40
Well here's my model! It's just a ball for now! The effect i am trying to get is this one:
.
Sorry for causing troubles, I'm a newcomer to shaders :

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2009 18:27
Try this shader. The default colours are a red body and a green edge. I hope it's obvious how to get black and white.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 9th May 2009 20:43
I hope this is the right place to ask this sort of question.


Where would I find information on how to use the commands that DarkShader uses?

I see new keywords that it added, but there doesn't seemt o be any documentation on them.
This is what I found in the ShaderData.ini file:


Not only do I not know what these commands do, but I don't even know what parameters they accept!

I was assuming these would be beneficial for grabbing information from a shader, such as names given to the textures within the shader. It would be very helpful to find that sort of information and store it in a program.


The one and only,


zapakitul
17
Years of Service
User Offline
Joined: 1st Mar 2007
Location: In my world
Posted: 9th May 2009 23:15
Haha, thanks Green Gandalf! I'm in your debt! Thank you all for helping me.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 9th May 2009 23:49
Plystire: I think the shader ini file is from the upgrades, I remember downloading one someone uploaded(GG?) of their own when I first installed dark shader. With the DS installation is the shader dll that needs moving to the compiler folder from DS, but one of the newer upgrades must include it for free; when I last upgraded I did a clean install first(7.3) - I haven`t yet needed to do anything to the installation like I used to have to and shader commands seem to compile fine. I would suggest maybe mailing Lee or post the question in one of the 7.3/7.4 beta threads if nobody knows. I was thinking some of the parameter ones where probably UI related. Their are parameter limits and step values for sliders and stuff in shader files:

Most of it looks self explanatory but I think we would be better off with some examples of how to use them
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 10th May 2009 02:44
Thanks, James.

What I'm trying to do is something similar to a UI. It'd be rather hard to do without knowing how to use those commands, too, so I hope someone here knows how to use them.

Just in case no body here does, I sent Lee an email asking him about it. If he responds, I'll let you guys know what he had to say on the subject.


The one and only,


Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 11th May 2009 00:15
Just got an email back from Paul Johnston.

Attached is the text file he sent me showing the commands and there inputs/outputs.

This was his email:
Quote: "Hi,

I've attached a list of commands for the DBPro version, the GDK version should include a header file that lists the same.

If you really want to dig deeper into the DLL there are some internal commands listed in the string table which I've also attached, but these are undocumented and I can't guarantee they'll all work. For the parameters, L=Integer, S=String, 0=No Parameters, and [=First parameter is the return type. Most of the internal commands require calling GET OBJECT EFFECT first.

Regards,
Paul"



The one and only,


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th May 2009 01:39
Quote: "Attached is the text file he sent me showing the commands and there inputs/outputs."


Not attached?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 12th May 2009 06:18
Hmmm... well, let's try it over here instead


The one and only,


Attachments

Login to view attachments
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 12th May 2009 08:58 Edited at: 12th May 2009 09:05
Alright, I'm at my wit's end with this shader.


I am trying to make a shader that does the following:
- Accepts information from 8 lights
- Uses those lights in the calculation for normal mapping
- Applies a DarkLights generated lightmap onto object
- Applies an Illumination Map onto object


From what I can tell.... this should work, but it doesn't. (How often does THAT happen when programming? )

I loaded this shader into FX Composer and it told me that the error it's getting is that I'm doing too much arithmetic!! Well, that's really lame.

Here's the effect:



Now.. if I make the pixel shader compile with PS3.0, FX Composer doens't find anything wrong with, but it's still messing up when I try to use it like that. (AKA, the object turns invisible, which apparently is the standard red flag that the shader has encountered an error)

Here's the thing. If I change this line:

to:

then the shader will actually work...... you know, minus the normal mapping and per pixel lighting.
As soon as I tell the LightColor to do any sort of arithmetic against anything on that line, it goes back to giving me an error.


I've been staring at and fiddling with this shader for a day and a half now, and I figured it was time to go ask for some assistance from the shader group.

Is there a way that I can get this to do what I want it to while still using PS2.0?


[EDIT]
Forgot to mention that this is the "NormalMapping" shader from DarkShader. I've simply added the DarkLights lightmapping texture and the illumination map.

[EDIT2]
The Lightmapping texture is applied properly.. and the strange thing is, the only time it will apply properly is if the "lm" texcoord starts as TEXCOORD1 and is then passed into TEXCOORD2 in the pixel shader. I don't quite understand why it won't work with any other texcoord numbers, so if someone could explain that to me as well, I'd be very greatful.


The one and only,


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th May 2009 12:38 Edited at: 12th May 2009 12:40
Quote: "I am trying to make a shader that does the following:
- Accepts information from 8 lights
- Uses those lights in the calculation for normal mapping
- Applies a DarkLights generated lightmap onto object
- Applies an Illumination Map onto object"


If you want to use PS2 then you will almost certainly have to split the pixel shader into two or more passes. My guess is that FX Composer is trying to tell you that you are trying to pack too many instructions into the pixel shader - the limit is quite low for PS2. I think EVOLVED had a shader in the Ultimate Shader Pack which shows how to use several passes for lighting.

Quote: "Forgot to mention that this is the "NormalMapping" shader from DarkShader."


It isn't. You've changed the critical line which says use PS2a rather than PS2 when using 8 lights - I'm fairly sure that was being done because of instruction count restrictions (PS2a allows more instructions).

If you're lucky PS2a might do what you want.

I'm too busy right now to look at this in detail for you, but if you still need help with this I can look at it in a few days time.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 12th May 2009 17:50
Alright, GG. Thanks very much for taking a look at it for me.

I'll try to use PS2a and if that doesn't work out, I'll see about maybe breaking it into multiple passes.


Thanks again!


The one and only,


Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 15th May 2009 08:19
The shader compiled when I used PS2a like you said, GG... but now the shader isn't wanting to work with my system


Thanks for the assistance, though. I'll keep hacking away at it.


The one and only,


Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 17th May 2009 12:26
Not sure if anyone's made this already in this thread, but I felt like sharing cuz I'm so proud of my shader.

I'm very glad this thread is here as it's helped me learn how to deal with shaders. I think my understanding of them has grown quite a lot. (Not even close to GG or Chris K, but I can dream )


This the motion blur shader I just made. I combined it with a tweaked Bloom shader, and the effect is quite breath-taking if I say so myself.
The test harness doesn't do it justice, really.

Attached (I hope ) is the shader packaged with some example source code (I don't know what I would have done if GG hadn't posted his better example up for people to use)


The one and only,


Attachments

Login to view attachments
Chris K
21
Years of Service
User Offline
Joined: 7th Oct 2003
Location: Lake Hylia
Posted: 18th May 2009 12:13
Couldn't get it to work unfortunately... just a black screen.

-= Out here in the fields, I fight for my meals =-
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 18th May 2009 13:03


That's strange.... it seems like all of the full screen shaders I make are starting to give me black screens!! They were working not even two days ago and I didn't do anything to them!


The one and only,


James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 18th May 2009 16:10
Actually Plystire the code is wrong - looks like you uploaded the old code by mistake!
(This still contains the swap error):
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 18th May 2009 23:58
Hmmm, it looks like it combined the old (deleted) package file with the new one I made.. The actual code to use for this is the one named "MotionBlur.dba". You can ignore the Bloom code

(I have some seriously bad luck with uploading files )



The one and only,


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th May 2009 02:43
Quote: "The actual code to use for this is the one named "MotionBlur.dba". "


Doesn't work for me - black screen and hangs machine. I need to use Task Manager to close it.

Will have another look tomorrow.

Quote: "I have some seriously bad luck with uploading files"


Seems to be true.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 19th May 2009 04:59
Okay, this black screen is starting to become contagious.

I don't know if it's the shader or not... It seems like all the full screen shaders are giving me black-screen problems now.


If someone would be able to look at the shader/source and maybe help me find what the problem is, I would be very grateful. This issue has spawned in my project and it has become quite a bother to deal with it.


The one and only,


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st May 2009 12:25
Plystire (and others )

I'll have a closer look at this in about a week's time - very busy right now.

Hopefully someone else can jump in and sort this out.

In the meantime, I suggest you simplify the shader by removing all the bits that your failing demo doesn't use. It might be much easier to debug it then - mainly because we won't waste time trying to understand bits of code that aren't needed.

There is also the possibility of course that the error might go away when you've removed the redundant code.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 22nd May 2009 02:51 Edited at: 22nd May 2009 02:57
Thanks for the suggestion, GG. I cleaned out the shader code of the unnecessary bits earlier and the problem is still persisting in my project.

The demo I posted worked fine for me even without cleaning the shader, so why it's showing up black for everyone else is a mystery to me.
Perhaps changing the backdrop color of the shader camera to something other than black will change the color you see as well? At least then we would know that the only thing the shader camera is seeing is the backdrop.


I hope when you get around to looking at this (or someone else), you'll be able to shed some light onto the subject.


[EDIT]

Attached is a snapshot of the demo working for me. (The edginess of the blur isn't noticeable at all when it's in motion because it only blurs when you move the mouse fairly quickly)


The one and only,


Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd May 2009 11:27
Thanks for the screenshot - that will be very helpful when I finally find time to look at the demo. It's what I would expect to see with motion blur and looks good.

I'm puzzled by your comments though:

Quote: "I cleaned out the shader code of the unnecessary bits earlier and the problem is still persisting in my project."


Quote: "The demo I posted worked fine for me even without cleaning the shader, so why it's showing up black for everyone else is a mystery to me."


Is the demo working for you or not - or do you mean you've given the cleaned out demo to someone else to try?

Could you post the cleaned out version? It would make it easier for me and anyone else wanting to look at it.

What are your machine specs? It seems unlikely that's the problem here, but you never know.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 22nd May 2009 22:28 Edited at: 22nd May 2009 22:35
The demo works for me. That source is a test harness for the full screen shader I am wanting to use in the actual project. The shader is giving me occassional black screens in the project but not in this demo. I'm hoping that if we can solve the black screen problem for people using the demo then it will lead to finding out what's causing the black screen in my project.

I haven't given the cleaned up shader to anyone as of yet. But I have attached it to this post. Use it with the source I posted earlier.

My machine specs are:
AMD Phenom 9950 2.6 GHz
2GB low-latency DDR2 RAM (Used to be 4GB before the accident )
ATi 4870HD GPU
700GB SATA HDD
Windows Vista Home Premium OS


Hope that'll help you out.


The one and only,


Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd May 2009 19:30
Quote: "The demo works for me."


The plot thickens.

I'm away from home at the moment and in a spare moment decided to try your demo on my laptop - both versions of the shader worked fine with your demo, albeit with an fps of 2 in each case.

It's beginning to look like a GFX card issue to me - but what exactly I can only guess. Certainly my new Cyborg ought to be up to the task - will delve deeper when I return home.

The good news is that your shader does what it's supposed to do - on some machines.

Of course it could be a DBPro upgrade problem - my laptop is still using U7.1 whereas my new Cyborg is using U7.4beta something or other. It couldn't possibly be that could it?

Perhaps others could report their GFX card/DBPro versions to help cast light on this matter?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 24th May 2009 04:07 Edited at: 24th May 2009 04:10
That is strange. I, too, am using U7.1 of DBP.

Perhaps something was broken in the new upgrades?
I don't dare upgrade my version of DBP unless given a specific reason to. I have had bad experiences with upgrading in the past, so that when I make a project that works in one version, I will remain in that version until I have sufficient reason to move onto another.

Although... this doesn't explain why my project (using the same shader) has problems showing it even though it's being compiled in the same version of DBP. The strange thing in my project is that it only shows the black screen when the origin (coordinate 0,0,0) is within view (though it may be hidden by other objects, it causes the black screen even if it's behind them)


The one and only,


James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 25th May 2009 02:42
Just a thought, but I just remembered that when I did a fresh install a few weeks ago I noticed that there where two shader dll`s in the compiler folder of the backed up installation. Commands are duplicated so maybe this is why?

Login to post a reply

Server time is: 2024-11-24 06:53:25
Your offset time is: 2024-11-24 06:53:25