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 / SHADERS - how do they work

Author
Message
Stevie
User Banned
Posted: 20th Aug 2004 22:34
I am really confused when using shaders. I downloaded the Nividia FX composer - and loaded one of the examples.

I then saved it to my DB file root directory and tried to load the fx file - but it said vertex cannot be assembled. Can anyone explain how these things work please.

create vertex shader from file 1,"glass.fx"
set vertex shader on 24,1
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 20th Aug 2004 22:47
Theres a hugely long thread known as the ultimate shader thread somewhere in these forums. Do a search for that and have a read.

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home
BealziBob
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location: The Grim North (UK)
Posted: 20th Aug 2004 22:49
Hi Stevie,

For more information than you could ever need go to this link:

http://forum.thegamecreators.com/?m=forum_view&t=28992&b=1

you'll find a few good ready made shaders in there too.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 20th Aug 2004 22:50
Try loading the vertex shader, the setting it as you have - I usually just load them up and apply them, but shaders tend to like their textures to be specified in the file - so don't be afraid to open the .FX file in notepad to change the texture assigning (.FX files are like a little programming language, which is complex, but quite easily customisable). Be sure to check all the help file examples too, there's a shader test thingy which might shed some light.

Be aware of the huge post on this forum about shaders too, you'll pick up usage tips in there, and also look for Raven's threads on customising shaders for DBPro.


Van-B


Muhahahahaha.
Stevie
User Banned
Posted: 20th Aug 2004 23:09
In order to make a specific shader work with an object - do i have to first load the objects fx fle into fx composer - and apply the shader there?? then save all the bits?

I know there are multiple details on shaders on this forumn - but to put it simple - they loose me!!! Can anyone be good enought o take the time and write me a small tutorial as to from ground upward how i apply a working shader to my model please. I would me most grateful
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 21st Aug 2004 01:01
Quote: "When using FX files obtained from the internet, it is likely the FX file will not load right away."


- Lee Bamber



Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
DcZee
22
Years of Service
User Offline
Joined: 28th Apr 2003
Location:
Posted: 21st Aug 2004 09:57
Stevie,..sahders are the hardware equivalent of Procedural Texturemaps. Procedural Texturemaps are basically texturemaps that are created through a mathematical formula rather than by mapping an image onto a 3d surface. In most cases the image mapped texture has been created by a paint program that used procedural texturemapping anyways. Procedural Texture mapping has been used in raytracers for many years,..but that is one of the reasons why raytracers generate their pictures slowly,..they are very math intensive. However, over the years the hardware has sped up considerably and now the ability to generate a procedural texture in real time is possible. Still CPU intensive, however the latest graphic cards offer "shader hardware" to take the load off the CPU. We can program the shaders the same way we use to program the procedural texturemaps, but now the shader is linked to the model and can produce amazing effects,..like realtime flowing hair, realistic waves and reflection mapping. Very nice,...

As for your moving tree limb its probably easier to just rotate the limb of the model u are using. Im not certain if TGC will be implementing a fully compatible Shader Effect system,...as it stand now some mods are required to make them work out of the box (RenderMonky and Fx composer can produce the shader files but without mods dbpro cant use them) It would be nice if that were different,..pick a standard and go with it.
But that tutorial on converting the shader to work in DBPro is a great one,..albeit a lot of reading.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 21st Aug 2004 13:46
Okay... I'm going to make this clear, and anyone else reading this thinking about using shader PAY ATTENTION to what I say.

Unless you understand how Shaders work, leave them the hell alone!

Alright you might be sitting there thinking, 'well how am I suppose to learn these fancy new effect if I can't use Shaders?'
Quite simply put, Shaders were NEVER designed for people like you.

They were designed as a way to give artists and programmers *direct* hardware access allowing them to program thier game effects *directly* onto the Graphics Card for a speed boost.
They were not designed for Teenagers using a BASIC Language, as such I would wager a very-very large portion of people in this forum (this actually includes the TGC Team) are fumbling through Shaders not 100% sure of what they're doing.

In order to use them you not only have to understand A-Level Mathematics (College Math Degree Level), but you also have to have an understanding of how it will affect your image not just in a 2D but 3D Environment.

If you CANNOT figure out how to do an effect using Standard Coding, then using a Shader is a waste of time! Simply because you won't even be able to come close to producing it within it.

HLSL is C-Style Programming (this is the language commonly used), ShaderASM is Assembly-Style Programming...
NEITHER OF THESE ARE LANGUAGES DESIGNED FOR PEOPLE WHO CAN'T COMPREHEND THEM.

Although it noted 'how can you learn something if your never taught?' when your ready to use this stuff, You Won't Need To Be!

Right now Shaders for most of this community are about as useful as giving everyone direct access to directx object data.
It would be fantastic for that 1% of the forum that actually understands how the hell to use it... for everyone else though we'll see 600 topics of them asking to achieve things with the Z-Buffer which are completely pointless.

Like 'How can I use the Z-Buffer to Visually Cull my object?'

Take the time to sit down and figure out how to do things with the ridiculously simplistic command set that Dark Basic Professional has before you think a Shader is the best course.

You fancy trying to alter the movements of limbs based on older limb data in order to give a nice swaying branch using the Vertex Shader, then go right ahead.
I'll tell you know what you need is a Model-View Matrix, Project-View Matrix, the Original Vector of the branch Vertex, the Directional Vector of the branch Vertex as well as a nice Fall-Off based CosSin which will affect the Vertices based on an Origin Point.

Oh yeah I almost forgot you'd also need another routine to make sure that the tree keeps it's shape by maintaining a distance from it's other vertices, so probably need a second pass for the shader with that data.

Personally, I think until Lee actually has the Shader working *exactly* how they do in DirectX9, people should leave them the hell alone unless they know what they're doing.
There is no damn reason for anyone here to actually use them yet, because in order for them to be useful you also need to understand the art of optimisation because DBP will not do this for you.

I mean this is all just like RayTracing Alogorithms. When you first do it you think 'YAY!' problem is there are no 'practical' uses for it because it's too slow.

You want a do something like a scene glow? Render the objects you want to glow, greyscale the textures, blur... then blend back with the final render.
How do you render some objects whilst not others? Simply hide/show objects.

You want to create reflective water? Use the stencil based Reflection Shading, on every card it will be 3-4x faster than if you used a Shader for the same effect because the Stencils are highly optimised now. For the water itself use a CosSin to alter the pattern of waves.
What if you want it semi-transparent? Ghost the texture you use.
And real-time lighting? Edit the Normals, or take the image texture and a normal map and take the vector direction from that, -(Dot3(Normal,Light Point)) to give you the new normal and export the new normals out to the map which you can then use Image Blend 24 to display. (well actually it should be 24 but thats buggy, try 2 instead)

I could go on for a good hour or two overviewing how the hell to do most effect using built-in dbp commands... but I'm not here to tell you how the hell to do things, your here to learn and discover. To figure this stuff out on your own.

Pick-up a damn math book and figure it out on your own, because no one is going to hand you exactly what you want on a silver platter and quite frankly it is rude to believe that it is our obligation to do so.
People are willing to help you and point you in the right direction, but we're not here to hold you damn hand!


Catalyst
21
Years of Service
User Offline
Joined: 6th Sep 2003
Location:
Posted: 21st Aug 2004 14:44
It's nice to see Raven so cheerful, it means he likes you.

Though I do agree with him in a way. Check out the ultimate shader thread. If you don't understand how to make shaders, you can still make them work in a game using other people's shaders. However, if you don't understand the info in the ultimate shader thread, it's really worth your time to learn at least that much.

Just to see some effects happen right quick, I'd recommend going to the end of it and grabbing some stuff from Ninja Matt. His are already working well and enough for you to see an effect in action. But learn what Neophyte has to say about making them work, you really need to be able to make sense of all that.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 21st Aug 2004 16:29
I do agree with Raven's message though - shaders are so complex that unless TGC supply us with some nice ones that definately work it's best to leave them alone.

Even I have no idea what they're on about!

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 21st Aug 2004 23:17
Raven is still my hero!!!!!

I looked at the shader information at NViadia's site and knew right away that I was not ready to even think about working with them.

But I am far from the smartest person here.......

Wasting CPU Cycles since the 286 was a hot machine.
Stevie
User Banned
Posted: 22nd Aug 2004 03:11
Raven - i am really disgusted at your tone - and by the way friend i aint a teenager - funny how i just got a nice shader working - without knowing a level mathematics........................

keep the tone down - this should be a friendly environment
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 22nd Aug 2004 03:36
Stevie, did you write your own shader from scratch though? Do you understand exactly how it works? If you knew exactly how it worked, and what the problem was then...
Quote: " vertex cannot be assembled"

wouldn't be a problem and you could've narrowed down the problem on your own.

I'm not trying to take a cheap shot at you, so don't take any offense, but Raven was very accurate in his words. Heck, if he replaced a few of the words he might be able to submit it to GameDev. "Why Shaders aren't for you"

Best we just keep it at that. I don't know much about how shaders work, so I just keep away.



A book? I hate book. Book is stupid.
(Formerly known as Yellow)
Stevie
User Banned
Posted: 22nd Aug 2004 04:10
Hi - yeah i see what ur saying Mike but i simply wat to use available shaders in my own programs. After all - what i think Raven doesnt apreciate it - is DB was designed with a e set of inbuilt tools - i.e. a 3d engine(rather than writing your own in C or something) and was designed for people to use the available tools with ease to get professional-like results. So i simply want to be directed as to how i use available shaders.

On another thread - i used fx composer's ocean fx - i loaded it in and it works in respects of making a wave like motion - but it is coloured black and no matter what i do i cannot get it to show its colour If anyone can help on this please do
ionstream
20
Years of Service
User Offline
Joined: 4th Jul 2004
Location: Overweb
Posted: 22nd Aug 2004 04:20
Raven, If someone wants to learn how to write a shader, and they keep trying at it, eventually they will become a shader master. It's the law of use. Don't tell them to stay away from shaders just because they don't understand it at first.

Of course nobody is going to ask how to use the Z-Buffer in a shader. That's absurd and redundant even to a newbie.

But if someone asks how to implement a Bump-Mapping routine, help him out! Theyre not being a jerk just for asking, they just need help.

And Stevie was never asking for math help!

Quote: "NEITHER OF THESE ARE LANGUAGES DESIGNED FOR PEOPLE WHO CAN'T COMPREHEND THEM."


Thats like saying "English isn't for people who can't speak it".

Stevie: Get the DirectX 9 SDK from [href]msdn.microsoft.com[/href]. It has all the information you need about making a shader in the Help section, along with EffectEdit, which is what the creators of DBPRO used to make their shaders.

"I see your dead, petrified skull labeled on a shelf somewhere." - Dennis the Menace

"Achoo" - Hitler
Stevie
User Banned
Posted: 22nd Aug 2004 04:24
cheers buddy,

I apreciate u standing u suporting me like that - thankyou. I have just got the sdk so i will check it out now
Stevie
User Banned
Posted: 22nd Aug 2004 07:49
One last comment - i think Raven should calm down and take a note out of everyone else's book on the forumn - everyone else is polite and is prepared to offer some help.
Stevie
User Banned
Posted: 22nd Aug 2004 08:06
I have just downloaded Ninja's shader pack and they display black!!!!!!!!! - what do u think i am doing wrong.

I put the gloss fx and graphics files in the same folder
and then used the commands:
load effect "gloss.fx",1,0
set object effect 24,1
Stevie
User Banned
Posted: 22nd Aug 2004 08:21
if i have a variable that was showing that its type was 3 - i take it that would mean it was a floating variable. Now if my flag showed a zero - it means that DB doesnt actually recognise this. If i use the following command - how come it doesnt set the variable to be understood as a float?

set effect constant float 1,"bumpheight",1
ionstream
20
Years of Service
User Offline
Joined: 4th Jul 2004
Location: Overweb
Posted: 22nd Aug 2004 08:23
Where is Ninja's Shader Pack? I need it to see what you mean.

"I see your dead, petrified skull labeled on a shelf somewhere." - Dennis the Menace

"Achoo" - Hitler
Stevie
User Banned
Posted: 22nd Aug 2004 08:28
mate - it is right at the end of the ultimate shader thread - i think the last but one page.

Just look for Ninjas comments and its a link on there
If not contact me on AIM and i can send it to you

My aim name is YERTARI
Ninja Matt
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Lincolnshire, UK
Posted: 22nd Aug 2004 09:03 Edited at: 22nd Aug 2004 09:07
@Stevie:
Wheee! My popularity has increased to two threads now!

Anyway, I never did make a 'pack', only a handful of individual shaders, and I haven't yet made a gloss shader, so it might be Preston's pack that you're talking about. As I haven't yet had time to check his pack out (damn resit revision!), I don't quite know what the problem could be, although here's a few suggestions:

On the line load effect "Gloss.fx",1,0, try changing the final 0 to 1. This means that the object will be mapped with the textures set in the .fx file. Otherwise, you've got to manually assign each texture.

Double-check that you have the textures in the right place and that your hardware supports the shader you're trying to use! Finding the latter out can be fairly tricky if you don't know what you're doing, but I think that DarkBasic gives you an error if the effect version is higher than your card can support.

If that fails, have a go at downloading some of the examples that I made. I've included a sample program with each one so you can be sure that the effect works, and so you know how to get it to work in your own program. I'd recommend trying the hologram shader first - http://mysite.wanadoo-members.co.uk/wisemonkeys/darkbasic/Hologram11.zip - since it contains only a vertex shader. Place everything in one directory, load the .dba file, and fire away!

@Everybody
Don't let Raven fool you too much - he does have some good points, but shaders aren't all that hard, especially if you're already familiar with the general principles of programming. The biggest catch is knowing where to start, really, since shaders can be very confusing to the new user, and there's quite a lot of maths involved; some that you need to know, some that you don't.

If you're interested in starting to program shaders, the first thing you'll need is a copy of either the DirectX SDK, nVidia FX Composer, or ATI RenderMonkey. Then, I'd strongly recommend starting with a basic DirectX 8 shader tutorial, like the excellent one at this address: http://www.shaderx.com/direct3d.net/tutorials/shader/shader1.html. This is an excellent tutorial (the one I began with!) that covers nearly every aspect of shader making, including hardware details, an ASM command reference, swizzling, register and instruction modifiers and, of course, the tutorials, which actually explain why each instruction is being used. Then, if you want to know more about the maths, I'd tell you to head over to http://www.flipcode.com/geometry/, which is a great place to learn about geometric vectors and their algebra. And, if that isn't enough for you, I'm planning to write a couple of shader tutorials myself over the coming weeks, which will focus on how to make a shader yourself, not how a pre-written shader works.

Remember, I only started with shaders about three months ago and, if I can understand them, I'm sure any idiot can!
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 22nd Aug 2004 09:47
I also recommend 3D Math Primer for Graphics and Game Developers. Okay, so I'm not ready for shaders and the book doesn't have to do with shaders, but it's an excellent book to learn about the 3D world of programming, and it teaches exactly what you'll need if you're just getting into graphics programming. Even though the source is C++, the principles have helped me so much with my DBP programming.



A book? I hate book. Book is stupid.
(Formerly known as Yellow)
Stevie
User Banned
Posted: 22nd Aug 2004 09:50
I downloaded the hologram fx file and it shows black on my object!!!!!!!!!! Whatever could be wrong

My graphics card does support shaders too
Ninja Matt
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Lincolnshire, UK
Posted: 22nd Aug 2004 11:23
Black? Even on the hologram shader? Hmmmm...

Okay, are you using your own code, or are you using the sample program that comes with the shader?

Could you quickly show me what the directory structure you've got is and, if it's your own program, a snippet of the source code?

We'll get to the bottom of this soon enough!
Stevie
User Banned
Posted: 22nd Aug 2004 11:32
Hi Matt,

I used your source code and ran it in the same directory as the associated graphic files. This is proving to be a very odd situation!!!!

Also could u tell me something too. When i run the checklist program to determine if DB understands the FX file - say it shows that a variable type is BUMPMAP - and its type is 3.

Am i right in saying that DB expects it to be 3(floating variable) - and therefore i need to use the set float command and put a value of 3 with it??/
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Aug 2004 12:06
A programmer's job is basically to solve problems. Don't know how a shader works, that's a problem. Solution, research shaders. Frankly, I couldn't care how complex someone thinks something will be. If I wanna know something, nothing will stop me from getting the answer, and nothing has yet. But if you're willing to go about things with that attitude, you're going to have to do things for yourself and not rely entirely on ppl to teach it to you. Raven did make a point somewhere in that page of ramblings, but I don't think it's the obvious one thats poking out of it.

"eureka" - Archimedes
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 22nd Aug 2004 12:28
@Stevie: What video card are you using? Not sure if you posted what you use in this post. If your video card truly does support shaders, it should handle my gloss mapping shader just fine, its like the weakest of the weak of all of the shaders posted on these forums period.

Also, I'm not sure if this should make a radical difference, but I developed all of my shaders in FX Composer with an NVIDIA card, then in effect edit and notepad for them to run in DBPro. So I'm not sure how they'll work on an ATI card.

Anyway, mind running this program and telling me what numbers are shown?



Quote: "Don't let Raven fool you too much - he does have some good points, but shaders aren't all that hard"


Quote: "Remember, I only started with shaders about three months ago and, if I can understand them, I'm sure any idiot can!"


Amen to that! Shaders are really easy to program, I've only been working with them with any actual attempt for about a couple of weeks, and if you download FX Composer, you'll have plenty of examples to show you how to do what you want to. Not to mention its really fun trying to get the effect you want (though, it can also be quite frustrating at times, but the end result is always amazing to look at if it works properly).

Quote: " I also recommend 3D Math Primer for Graphics and Game Developers."


Also, along with that, may I also suggest Real Time Rendering Second Edition by Tomas Akenine-Moller and Eric Haines? Good read and helpful when you need an explanation on how an effect is done or if you need an idea for an effect.

Cheers,
Preston


Fear My Ugly Avatar and Out of Place Signature Image!
Catalyst
21
Years of Service
User Offline
Joined: 6th Sep 2003
Location:
Posted: 22nd Aug 2004 12:30
Just a note on the video card being able to use shaders or not. Correct me if I'm wrong, but if his card did not support that shader version, it shouldn't be black. It should give a "Shader can not be found at line X" error, or something like that.
Stevie
User Banned
Posted: 22nd Aug 2004 12:37
Hi Preston - its a Gforce fx 5700 oc - which supports the shader 2 protocol.
Stevie
User Banned
Posted: 22nd Aug 2004 12:40
I run your code Preston and the number generated was 2,2
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 22nd Aug 2004 12:51 Edited at: 22nd Aug 2004 12:54
...

I'm out of ideas now...that card should run those shaders without any trouble at all.

All I can suggest now is the usual stuff:
1) Reinstall DirectX 9.0b or c.
2) Reinstall Your Video Card Drivers.
3*) Build a shrine to bill gates and microsoft and sacrifice a pepperoni pizza to them at the shrine every evening.

Cheers,
Preston

[PS] *This one isn't actually useful or serious in any way...but you never know.


Fear My Ugly Avatar and Out of Place Signature Image!
Stevie
User Banned
Posted: 22nd Aug 2004 12:55
Preston can u supply me with some small code that runs the shader perfect on your machine, using a simple object - i will run it and see what happens. Thankyou
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 22nd Aug 2004 13:06 Edited at: 22nd Aug 2004 13:09
Sure thing, this is the exact program I use to test all of my shaders (unless they require more than just activation to run):



Input the location and name of the .fx file and watch.

Cheers,
Preston


Fear My Ugly Avatar and Out of Place Signature Image!
Stevie
User Banned
Posted: 22nd Aug 2004 13:15
I dont believe it!!! I get a grey screen - witht the FPS info on top, no polgons showing ad no shader.....

This is very odd
Catalyst
21
Years of Service
User Offline
Joined: 6th Sep 2003
Location:
Posted: 22nd Aug 2004 13:18 Edited at: 22nd Aug 2004 13:18
Sounds like you didn't locate the shader properly when prompted.
Instead of specifying when prompted, might want to just change the code so it goes to the shader by itself.
Stevie
User Banned
Posted: 22nd Aug 2004 13:23
Thats what i did mate - i thought of that too - i actually typed Gloss into the code - and still the same.. This is so odd
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 22nd Aug 2004 18:39
Was gloss.fx in the same directory as that program, and did yoy type "gloss.fx" or just "gloss"?

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
Try
20
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 22nd Aug 2004 23:32
Hi everyone

@Stevie

i read the posts and by knowing that your card is a good one and can handle PS 2.0 and VS 2.0 and that you couldn't even run Ninja Matt's hologram shader, i a little sure that you need to upgrade your DBPro

if you have upgraded your DBPro to a version more than 5.2 then i can say i was wrong and sorry

but if you didn't i can recommand you to upgrade to 5.5!

GOOD LUCK

sorry for the poor english
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 23rd Aug 2004 00:06 Edited at: 23rd Aug 2004 00:07
I have a geforce 4 ti4800, don't know whether it was meant to run but I only got a black screen with the hologram shader too.


Removing the "ghost object" I do however get a flash of a blue torus then black.

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Aug 2004 02:10
The hologram shader doesn't work for me either. I get nothing displayed. I have db 5.5, dx9b, and FX5900

"eureka" - Archimedes
Ninja Matt
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Lincolnshire, UK
Posted: 23rd Aug 2004 06:35
Well, I've finally got around to downloading Preston's shader pack, and they all work fine. I'm on ATI hardware (Radeon 9800 Pro), so it doesn't look like there's any compatibility problems on my end.

Could I just ask what version of DBPro everyone's using? I'm currently still on version 5.2 (although I'm downloading 5.5 now to check it out) and I haven't had any shader problems. The only slightly odd thing that's happened to me is that DarkBasic seems to be treating inverse matrices as inverse-transpose matrices, and vice-versa. Perhaps that's a problem that was fixed in the later patches...

But, even then, there's a good few people who haven't had problems with my shaders. If you can get them to work, what make of video card do you have and what version of DB are you using?
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 23rd Aug 2004 06:44
I'm on 5.5

I'm really looking forward to getting hologram to work, it looks fantastic!

Get 15 new commands, all the date / time commands left out of DBPro for free!
DOWNLOAD PLUGINS HERE: http://www.davidtattersall.me.uk/ and select "DarkBasic"
Catalyst
21
Years of Service
User Offline
Joined: 6th Sep 2003
Location:
Posted: 23rd Aug 2004 06:58
I'm on 5.5 with a Radeon 9800 Pro....shall we start some chaos and say it only works on ATI cards? Okay,maybe let's avoid that....

It may be worth mentioning I'm on DirectX 9c, but I would be very suprised if that actually made the slightest bit of difference in this case.
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 23rd Aug 2004 07:17 Edited at: 23rd Aug 2004 07:21
It doesnt. I've just tested it a few hours ago and I can't get it working either, and I'm using DirectX 9.0c. The metallic shine works wonderfully, but the other one doesnt.

Guess your using ATI only things in the shader Ninja Matt, us NVIDIA users can't get it to run properly.

Cheers,
Preston

[Edit] [Edit2] Edited out what I just basically said above


Fear My Ugly Avatar and Out of Place Signature Image!
Ninja Matt
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Lincolnshire, UK
Posted: 23rd Aug 2004 07:51
So, the metal shader works, but the hologram shader doesn't? That's odd, but it does give me an idea - try this new version of the hologram:



I've already checked through the instructions between the hologram and metal shaders, and there were no differences there. Still, I've removed the m4x4 macros, to see if that helps and, more importantly, I've added a very basic pixel shader to the hologram. Originally, I omitted a pixel shader because my computer behaves normally without one - it simply textures the object as if it had been through the fixed-function pipeline-type thing, but it might not do so on nVidia cards. If that's the case, it would certainly explain the black-object problem, since shaders usually assume a colour value of zero if no data is provided in the situation.

Anyway, could somebody who couldn't get it to work give this new version a shot and see if it helps? It should drop nicely into the original sample program that I made, if you don't want the hassle of setting it up yourself!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 23rd Aug 2004 08:46 Edited at: 23rd Aug 2004 09:09
Matt the *only* reason it didn't work on the GeForce cards is because you didn't add the pixel through-put.
Radeons add it automatically, i'd go into it more... but i'll let your discover the joys of Radeon Shader programming for yourself.

Needless to say, ATi really don't get the point in shader what so over.



there's the GeForce Friendly version.
you can see why I prefer developing on GeForce now though, when I do so... I know it'll work on the competitors cards.

[edit.]



that should work on your Radeon, atleast it does on my X800. I have to sort out some things for it to run on the GeForce, cause I copied it close to exactly in HLSL format.


Stevie
User Banned
Posted: 23rd Aug 2004 09:06
I wonder why the shaders dont work - but they do on Prestons machine??? With respects to a previous question - i am understanding that when u do a check on the parameters DB needs to run the shader - if it comes up with Script - Var type 3 - when i use the command to change the variable flag - it doesnt work. Is my understanding wrong - that if it comes up with the var type and then a 0 at the end - all i need to do is to change its var type to 3 - which would be float??
Ninja Matt
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Lincolnshire, UK
Posted: 23rd Aug 2004 11:01
@Raven:
Uhh, Raven, I'd already guessed that nVidia was lagging behind ATI a bit and so had written out a new version of the shader. In fact, looking at it, your "GeForce Friendly Version" has a 'missing' pixel shader exactly the same as mine, even down to the comments. Likewise, your Radeon-friendly version, which I didn't exactly need anyway, is a pretty simple ASM-to-HLSL conversion. Even I, with my limited knowledge of HLSL, can tell that.

Quote: "I'll let your discover the joys of Radeon Shader programming for yourself."

I'd guess your intention is for that to be a sarcastic comment. What you probably don't realise is that it's actually true. Radeon shaders are a joy to work with - as well as offering more temporary and texture registers, even the most modest Radeon cards have support for the highly-flexible PS 1.4, which is a great step-up from the earlier versions. Oh, no, wait! I forgot - Radeon cards don't have support for PS 1.4, do they Raven?

You can see why I prefer developing on ATI hardware - I don't get bogged down with missing functionality! The side-effect, unfortunately, is that I've occasionally got to deal with nVidiots...

@Stevie:
It doesn't really matter what the var type is, so long as the last value, termed the hook value (I think), is a zero. If it's a zero, then the value is automatically being entered into the shader by DarkBasic, and is usually a matrix like World, View, WorldViewProjection, etc. If the hook value is a one, however, then DarkBasic doesn't know how to enter the value automatically, and that's when you need to provide your own value.

To do so, you'll want to be using one of the commands set effect constant float/vector/matrix. This way, you can feed your own data into the shader. For the most part, you shouldn't need to do this though, especially on simple shaders! If you're trying to get mine to work, you can see what constants need manually setting and how to do so in the sample programs.

@Other People with nVidia Hardware:
Any luck getting the updated hologram shader to work? I'm quite eager to get this sorted out, so I can make sure my future shaders are nicely compatible.
Preston C
22
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 23rd Aug 2004 11:10
Quote: "@Other People with nVidia Hardware:"


You mean one of us nVidiots

Yeah, new shader works like a charm. Looks great too.

Cheers,
Preston


Fear My Ugly Avatar and Out of Place Signature Image!

Login to post a reply

Server time is: 2025-06-01 09:29:03
Your offset time is: 2025-06-01 09:29:03