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
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 25th May 2009 07:39
I only have one shader dll in my compiler folders


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: 27th May 2009 14:50
Now back home and done some testing using Cyborg.

As suspected the new version doesn't work either - using U7.4beta6 and Vista and a version of the new editor (completely lost track of which new version I'm using ).

However, I decided that the problem might just be something to do with the display settings and as an experiment I changed the first few lines of the dba code to:



The demo now runs fine.

Will try to find time to narrow down the cause further.

Perhaps a few other people with the "black screen" problem could try this as well.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 27th May 2009 15:45
Now I`m using the right dba I don`t get a black screen!(u7.1) However after playing around I did notice that the slightest alteration of the camera angle changes all previous images blur directions to match the camera rather than leave them where they where; also there appears to be no blur on movement. To me it looks odd when slowed down for rotation and sped up for movement(altered the code slightly)
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 27th May 2009 20:30 Edited at: 27th May 2009 20:39
@Green Gandalf:

Thanks for looking into it. I would like to know why setting the display is causing it to fail when compiled in the newer version.

It would be bad if I wasn't allowed to change the display at all in the project. That would mean no display settings


@James:

Well, this motion blur shader was only designed to make the blur happen in X and Y directions. So it would be rather hard to get it to blur realistically upon movement.

I made it for use with an FPS, and unless you're running at super speeds, I don't think it needs a movement motion blur.


The one and only,


mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 4th Jun 2009 20:07
Hello there!
In my thread http://forum.thegamecreators.com/?m=forum_view&t=151765&b=1 i posted code that makes strip image, cubemap. Maybe there is some shader commands that can use such image as a cubemap?

Lee Bamber is so~o swett'n'cool desu nya ^^
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 14th Jun 2009 16:19 Edited at: 14th Jun 2009 16:20
Re black screens problem. I`ve just discovered 2 things. a) I have 7.3 installed but all editors report 7.1 instead. b) 32 bit fullscreen exclusive mode either using properties menu or using set display mode(with set window off) always produces a black screen for me no matter what - even with just a cube in a scene. However 16 bit is fine. I have recently changed my nvidia drivers to latest which has ambient occlusion, to rule this out I reverted to previous version, but get same result. Anyone else get the same?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Jun 2009 19:25 Edited at: 14th Jun 2009 19:48
Quote: "Re black screens problem."


I'd forgotten about this. Sorry.

Quote: "32 bit fullscreen exclusive mode either using properties menu or using set display mode(with set window off) always produces a black screen for me no matter what - even with just a cube in a scene."


I think you need to remind us of the code and media you are using.

Edit Was it PlyStire's motion blur demo that you were discussing? If so, then it works here with the fix I mentioned earlier - and if the display setting is changed to:



(copied from the dbpro file just in case ).
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 14th Jun 2009 21:18
Ah sorry, with any code, not just shader related code or Plystire`s. If I compile any 3d stuff in 32 bit fullscreen exclusive I get a black screen though not if compiled in 16 bit fullscreen. 32 bit windowed mode is fine too. Plystire mentioned he got a black screen at random times. I was thinking along the lines that he could sometimes be using project files that have fullscreen exclusive parameter set and so there may be a bug with 32 bit fullscreen - or theres something wrong with my dbp installation - all other games run fine in fullscreen 32 bit, dbp is the only program affected leading me to think the drivers are fine. I don`t have a problem with compiling his source(I did as mentioned earlier but was using wrong dba) and got the wrong end of the stick as to the motion blur he was setting out to achieve. I also posted here in case anyone else who had the black screen had similar problems - it could be the upgrade I am using.
Possibly related, I have noticed that evolveds defferred demo only works for me in either 640*480, 1024*768 or 1280*1024 anything else gives near all black screen with the vague outline of trees, land etc
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Jun 2009 23:21 Edited at: 14th Jun 2009 23:25
Thanks for the clarification.

As far as PlyStire's black screen problem is concerned I must admit I'm baffled - I certainly get the black screen when I think I shouldn't. Haven't got much time to experiment at the moment but will try to remember to keep this under review.

Regarding your more general black screen problem I really am baffled and haven't experienced anything like it. Perhaps you could post a complete, but simple, project which gives the problem on your set-up. Then we can test it.

Edit I wouldn't usually advise this but perhaps you could include the executable as well. Then we can see whether the problem is your particular compiled version or something else.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 14th Jun 2009 23:23 Edited at: 14th Jun 2009 23:29
Ok problem was the quality settings for the graphics card in ntune. DBP will not run fullscreen mode 32 bit succesfully if I put the slider bar in the Image Settings Preview on Quality; runs fine if on Performance or inbetween the two. I would like to know how other peoples cards react to highest quality settings whilst trying to use 32 bit fullscreen resolution in dbp. Have only tested under 7.1 and 7.3. I was gutted when Evolveds demo would only run in windowed mode, I wanted to see it with full quality settings and fullscreen exclusive mode would show it off best - 16 bit looks awfull. I used to never use fullscreen exclusive mode because of the performance hit on my older machines(even with graphics set to performance). Now its really the only one I choose unless I need to be in windowed mode. Guess I`ll have to see if downgrading will help. If I hadn`t updated my drivers, the quality settings would not have changed and I would have missed this. If anyone with an 8 series nvidia card could check if the result is the same for them I would appreciate it.

Edit: just saw your post GG - possible the quality settings are behind a few things? Maybe DBP needs either overiding graphics options panel or some commands to change the settings.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Jun 2009 23:26
Our posts (and my edit) crossed.

I'll try to find time to do the tests you suggest.
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 15th Jun 2009 00:08
It reminds me of an old problem I had: sometimes, DBPro can't render properly into the images made using Set Camera To Image. The strange thing is that it does not necessarily happen when creating large images: 1280*1024 can be fine and then, 800*600 gives a black image or some random dots. Unfortunately, I haven't been able to prove that it's a DBPro bug (even though I'm deeply convinced it is) because it seems to depend on the computer.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 15th Jun 2009 00:17
My edit crossed too
Narrowed it down to the anti alias setting of 4x - every other anti alias setting works fine(2x, 8x etc) and no other graphics option or setting affects dbp in the same manner. Given my previous drivers gave the same result when I reverted back to them(latest are now back on system), I can only think of of the following ways this occurs.
a)driversweep does not clean nvidia drivers as intended, if this is the case then perhaps the old drivers do work, will need a fresh install of os, but then again all games work fine with same graphic settings(all gaming profiles match global settings)
b)somehow my outdated bios is affecting it
c)I have PCIE1.0 mobo with a PCIE2.0 card, maybe they are not as compatable as claimed or the bios update may fix?
d)DBP is at fault
c)my card is slowly dieing after just 1 year 6 months chosing to eliminate AA4x first...
Will have a go at the bios tommorow, then if all else fails I may look at a fresh reinstall of the os. Will wait a few days though, see if anyone else experiences this. Thanks for your time so far, I hope you get time to test, and anyone else if they could.
GrumpyOne
17
Years of Service
User Offline
Joined: 27th Nov 2007
Location: London, UK
Posted: 15th Jun 2009 00:23
Hi,

Shader newbie question. I've scanned the last 33 pages (!) but didn't find an answer. I'm a bit confused with HLSL syntax for swizzling with floats. I understand swizzling with vectors and matrices, but not the following syntax for floats:



If someone can explain in one or two syllable words I'd be greatful.

Thanks,
Matt

GrumpyOne - the natural state of the programmer
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 15th Jun 2009 00:52
Guys tell me plz is it avaliable to write sphere-mapping shader???

Lee Bamber is so~o swett'n'cool desu nya ^^
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 15th Jun 2009 01:08
GrumpyOne: this line is really tricky, it's actually creating a vector out of a float. You have to read it that way : float2 h= (0.5f).xx
If you still don't understand, the .xx part means 'take the x component of the previous value and put it in the x component of h, take the x component of the previous value and put it in the y component of h'. I am surprised that it works with floats, because it is normally used to extract a vector component (like float width = size.x).
What I would usually write for such a thing is float2 h = float2(0.5f, 0.5f);
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Jun 2009 01:20
What Math89 just said.

The "0.5.xx" thing is just a bit of shorthand that I sometimes use - although not needed in that particular example as "float2 h= 0.5" would suffice.

The point is that 0.5 is a float and has just one component, i.e. the "x" component, so 0.5.xx just creates a vector of length 2 with each component equal to the "x" component of the float 0.5. This trick is more useful for writing constant assignments such as "float4 k = float4 (0.5, 0.5, 1.0, 1.0);" as "float4 k = float4 (0.5.xx, 1.0.xx);". Not much of a saving really - and probably compiles to the same thing.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 17th Jun 2009 11:53
Never got chance to change the bios, in fact I no longer have any of my machines. Unfortunately I`m homeless right now so this may be the last chance I get to post here(not that I post often). Any way I`m posting from a friends machine to let you know that running in fullscreen exclusive mode 32 bit color, while forcing anti alias to 4x still gives a blank black screen for any program compiled in DBP when I tested on my mates machine just now(obviously the compiled exe does not carry the issue from machine to machine - AA has to be forced). His setup is stable, has been for some time - 8800GTX 512vram, 2 gig ram, 3 gig dual core, non-esa nvidia mobo(with updated bios) - all drivers are latest signed drivers and all games run well except when he overclocks cpu beyond 3.6gig. Also his board and card are both PCIE1.0. Now I`ve seen this on two machines that run solid with other games and as I said in other post the issue is restricted to 4x AA only, and now it seems DBP. This time I tested in 5.4 and 6.9 aswell as 7.1 and 7.3. I don`t have time to test them all(I`m not staying here at my fiends), any way times up for me, if they let me in the public library later or tommorrow(not every one likes vagrants) I`ll either mention this on 7.4 thread or post a bug report - probably a bug report as I can`t test 7.4
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Jun 2009 12:58
Certainly sounds a bug worth reporting. Shame the example is so complicated - makes it very hard for Lee (or anyone for that matter) to narrow down the cause. On the other hand the specific symptoms you describe might be sufficient for someone who knows the inner workings of DBPro.

I'll try to find time to narrow this down a bit more today - or to at least confirm your findings.

Hope your accommodation difficulties get sorted out soon.
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 18th Jun 2009 07:14
maybe there's one in this thread already, but it's a big thread

anyone want to make a useful little set of "example shader code"?

i just noticed this new section of the help command set, object effects, with a whole static universe at your disposal. this is related to the shaders right?

if someone could write a program where you walk around a simple media-less world, with shaders (from that free shader pack, so we all have access) applied to different objects, sort of like a simple gallery showing what all those free .fx look like in game) that'd be very useful for us just starting to learn shaders!

also, an example program with that static object stuff would also be useful
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 18th Jun 2009 07:21
so when applying a shader like a bump map, does the DBP light (say you have a couple DBP lights in your scene) affect shadowing from the bump/normal map? or do you have to set up special lights for the shaders?

how do you get multiple effects onto one object, do you just "stack" the shaders aka, load effect A, load effect B,load effect C? say you have a starship and want one part looking metallic, one part glowing bright as a part of a control console computer screen, and some parts as glass/transparent. so you'd need a metallic .fx on certain parts of the object's texture... you'd need a specular .fx on certain parts of the texture... and you'd need another (glass/ghost/transparent effect) .fx on other parts of the texture for the object?

can you just "load a .fx and apply it to object", or is there other stuff you have to do in DBP?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2009 11:48 Edited at: 18th Jun 2009 11:56
Quote: "maybe there's one in this thread already, but it's a big thread

anyone want to make a useful little set of "example shader code"?"


You're right, there is a big need for this. It's been on my "to do" list for some time. I will have much more time than usual this coming autumn and winter after I retire and aim to get a big pack of shaders and demos together - unless Dark Coder or someone beats me to it.

Quote: "if someone could write a program where you walk around a simple media-less world, with shaders (from that free shader pack, so we all have access) applied to different objects, sort of like a simple gallery showing what all those free .fx look like in game) that'd be very useful for us just starting to learn shaders!
"


That's part of the plan - but I'd better concentrate on sorting out the shaders themselves first.

Quote: "so when applying a shader like a bump map, does the DBP light (say you have a couple DBP lights in your scene) affect shadowing from the bump/normal map? or do you have to set up special lights for the shaders?"


I usually set up special lights for the shaders using the "set effect constant" commands - there should be a few examples of that in this thread and elsewhere. It might be possible to pass the standard DBP lights via "semantics", but I rather doubt it since the Dark Shader shaders don't do that.

If you're serious about shaders you would do well to get Dark Shader - it comes with several sample shaders which illustrate how to do this and several other nice things.

Quote: "how do you get multiple effects onto one object, do you just "stack" the shaders aka, load effect A, load effect B,load effect C? say you have a starship and want one part looking metallic, one part glowing bright as a part of a control console computer screen, and some parts as glass/transparent. so you'd need a metallic .fx on certain parts of the object's texture... you'd need a specular .fx on certain parts of the texture... and you'd need another (glass/ghost/transparent effect) .fx on other parts of the texture for the object?"


There are two ways:

1. construct the object using several limbs and apply a different shader to each limb using set limb effect;

2. incorporate the different effects into a single shader and use light or specular maps, etc.

Method 1 is the simplest and runs faster - but is all or nothing, so you could have, say, metallic wings and a bump-mapped body but not both at the same time on the same limb.

Method 2 is more complicated and GPU intensive but gives more generally useful results. You need to write the code so all the effects are in the same shader "technique" - either as a single pass or several passes if the code is too long for a single pass. This method is often used with light maps, specular maps, etc, which show which parts reflect or receive light, etc.

Often a combination of the two methods will work well.

I intend to include simple examples of this idea in my pack (my retirement is going to be busy ).

Quote: "can you just "load a .fx and apply it to object", or is there other stuff you have to do in DBP?"


In simple examples, yes. But if you want to control things like textures, light positions and colours or fog intensity then you need to do a bit more - there are many examples in this thread and in the Ultimate Shader pack.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 18th Jun 2009 18:03
Why isnt this stupid thing shakes only back and forth, it should shake in circles??

Fx file:


dbpro:


There is always one more imbecile than you counted on.
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 18th Jun 2009 18:16
Because you have to change one of the sin to a cos.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 18th Jun 2009 18:44
Yes at first I did, and its same back and forth again.

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: 18th Jun 2009 19:03 Edited at: 18th Jun 2009 19:12
Quote: "Why isnt this stupid thing shakes only back and forth, it should shake in circles??"


I don't understand. It doesn't shake only back and forth - and it doesn't move in circles either. It just distorts in some strange way.

What are you trying to do? Are you trying to move the whole object in a circle, or each vertex separately?

Also a texture would help you see how it really is moving.

Quote: "Because you have to change one of the sin to a cos."


How would that help?

Edit Just noticed that your shader uses TEXCOORD1 as the input source for IN.Rotation. What values do you think that has? I get different results with your demo depending on which machine I use.
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 18th Jun 2009 19:14
If rotation.x and rotation.y are the same, they will return the same value, and move the object in diagonal.
And the distortion probably comes from the parameters of the sin functions to be the uv coordinates. If you need to pass some angles to the shader, you should add some global variables at the top and use the Set Effect Constant commands.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2009 19:28
Quote: "And the distortion probably comes from the parameters of the sin functions to be the uv coordinates."


That seems to be true on one of my machines, but not on the other. My new machine seems to set them both to zero presumably since the object doesn't have stage 1 UV coords, only stage 0?
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 18th Jun 2009 19:31
It might depends on the graphics card, I have experienced some very annoying (and stupid) bugs when trying my shaders on an ATI card.
Just in case anyone is interested: you can't use a vertex shader 2 with a pixel shader 3 on an ATI card, even though it works perfectly on an nvidia (it took my a whole day to figure it out).
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2009 20:07
Quote: "It might depends on the graphics card"


I'm sure you're right. I experienced something similar yesterday.

I was using a cubemap texture and was accidentally reading it using sampler3D and tex3D instead of samplerCUBE and texCUBE. I didn't notice the error till I tried it on my new machine which screwed up the texturing - it worked as I intended despite the error on my other machines. Took me a LONG time to track down the problem.

It would be nice to know where these sorts of GFX card differences are documented.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 18th Jun 2009 21:38
I've just gotten into shaders recently, and although I'm getting pretty good with vertex shaders, I haven't really dug into pixel shaders yet--specifically fullscreen pixel shaders. Is my best bet to make a plane that's positioned in front of the viewport, texture it using Set Camera To Image, and apply the pixel shader to that, or is there some easier method that I'm missing?

i like orange
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2009 22:29
That sounds like a good start - and probably worth doing anyway because it'll give you a feel for how things work together.

I think there is a way of simplifying the steps slightly using some recently introduced commands (a year ago?). However, I don't think you gain much and I don't think I've used them yet. I have a feeling that Chris K or someone posted a demo on this thread showing how to do it.
Mini Malistix
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: @home
Posted: 18th Jun 2009 22:57 Edited at: 20th Jun 2009 18:33
I think it was possible to texture the screen with the "quad.fx" in the snippet folder.

Something like this:



Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 19th Jun 2009 00:25 Edited at: 19th Jun 2009 00:27
Hey i've just started learning to write hlsl on last thursday and i've made this shader:


It's got two light sources, diffuse, specular, glow, and normal texture maps. However i think it needs optimization however being a beginner in hlsl i'm not sure what can be done to this to really speed it up. Could i be getting these low frame rates because of my gpu? I'm on an Intel g31/g33 express chipset with shader model 2.0 and the latest directx 9. I'll post the shader to see if you guys can help me out with it, and here is what you need to set to use it (with gdk syntax, but it will still help):



and here is how the textures are applied to the model:


I'd post the media i'm using but the files are fairly large and i'm sure if youre working with shaders you have your own media to use. The model i'm currently using is called Imrod, and he can be found at parkparkin.com/

Attachments

Login to view attachments
Mini Malistix
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: @home
Posted: 19th Jun 2009 15:49 Edited at: 20th Jun 2009 18:33
Hi. I found a fullscreen shader in the wires and put it into the quad.fx.

EFFECT:



DBPro Code:



EDIT:

Can someone confirm if this example works? So I can show you some basics. (i will try )
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jun 2009 14:36
Quote: "Can someone confirm if this example works?"


Did you?
Mini Malistix
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: @home
Posted: 20th Jun 2009 17:20 Edited at: 4th Jul 2009 07:12
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jun 2009 17:37 Edited at: 20th Jun 2009 17:51
Shame your code doesn't work though.

I just get the black screen problem again.

Quote: "You need:

- DarkGAME Studio compatible version of DarkBasic Pro
"


Why?

Edit The shader DOES seem to work in Dark Shader - see screenshot (I've no idea what it's supposed to look like though).



However, it just gives a black screen and refuses to close cleanly in DBPro. I'm using U7.4b7.

It sounds as if there's still a bug in the latest upgrade. Could someone else test MM's demo as well?

Attachments

Login to view attachments
Mini Malistix
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: @home
Posted: 20th Jun 2009 17:59 Edited at: 20th Jun 2009 18:06
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 20th Jun 2009 18:10
Works fine for me, using the U7.4b7... But as MM stated, it completely crashes when using the fullscreen mode.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jun 2009 18:19 Edited at: 20th Jun 2009 18:20
OK, this seems to be another example of "the black screen problem" discussed a few posts back.

This is a very simple example and, with your permission Mini Malistix, I'll send this to Lee with some comments.

As in the earlier example, this demo works for me on this machine (U7.4b7, Vista 64 bit etc) if I remove the first two lines, whereas I only need to remove the "reload display pointer" line on my laptop (U7.1something, XP, etc).

What do you think?

Edit Nice effect when it works.
Mini Malistix
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: @home
Posted: 20th Jun 2009 18:28 Edited at: 20th Jun 2009 18:35
Quote: "
This is a very simple example and, with your permission Mini Malistix, I'll send this to Lee with some comments.
"


GG - ..feel free..

EDIT:

Ok, i removed the line "Reload Display Pointer" it's not needed.

BTW. After hitting the "black screen of death" i had to reboot my computer.
Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 21st Jun 2009 06:29
Hmm would it be more beneficial for me to create a deferred shading system rather than using a regular shader with input from more than one light source?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Jun 2009 11:29
Don't know. Try both.

It's much simpler to write a shader which uses more than one light - or use one that's already available:

Evolved's lighting shaders

Or you could use the one that comes with Dark Shader.

The use of several lights can seriously slow down your application - unless you are careful. For example, you could design your scene so that no more than two or three lights affect a single object or limb at the same time. That way you can have a large number of lights in the scene lighting many different objects.

Better still, use a lightmap for static lights and objects.
Math89
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 21st Jun 2009 13:00
Using one shader per object is a good way to have more lights for a smaller cost, but unfortunately, there is no Clone Effect command, and loading a lot of shaders can take a while.

Deferred shading is a solution I really like, but there is no way to optimise it in DBPro. What is usually done for deferred shading is to use Multiple Render Targets. It means that one render pass will fill a few images. This is obviously not possible in DBPro (unless there is something about it in an upgrade, but it seems ulikely) so we have to render each image at once. This is a huge waste of time because vertices need to be sent to the graphic card for each render, and then, each shader pass has to perform some calculations which are already done by another one.
As long as we can't have MRT in DBPro, deferred shading is a false good idea. It looks very good and efficient on small scenes with a few cubes, but once you get some animated models, you can't get more than 20 fps in 800*600...
Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 21st Jun 2009 20:20
No MRT? does this go for the gdk as well? As the gdk is actually what i'm using, is there anyway in the gdk to directly access these things via directx to accomplish this?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Jun 2009 21:50
Quote: "does this go for the gdk as well?"


I rather doubt it. I assume that you can write the necessary C++ code yourself as part of your DGDK program - it's just the built-in DGDK versions of the DBPro commands that are limited.

I'm not sure though because I'm not a DGDK user.
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 22nd Jun 2009 19:47
Oh guys please give me just a hint where to search for sphere mapping shader...

Lee Bamber is so~o swett'n'cool desu nya ^^
Indecom
17
Years of Service
User Offline
Joined: 23rd May 2007
Location:
Posted: 22nd Jun 2009 20:08
search google, sphere mapping shaders are easy to come by, and in fact, dbpro has one built in, so why not use that one?
mr Handy
17
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 23rd Jun 2009 21:00 Edited at: 23rd Jun 2009 21:09
@indecom
Well, i'm going to make environment bump shader, like Evolved's one,
but i need to replace standart "cubic" part to sphere mapping, or, much better alternative cubemap.
Alt.cubemap means using... err i dont know how this thingie called... umm lets say "uncompiled" cubemap, "stripe" image...hope you get it
So i found out, that our dear Dark Basic dont "like" cubemaps at all if they're not "compiled", and "compiled" cant be used anyhow as image. So my challenge is to find a way to "push" into shader "stripe" image and tex' it like cubemap.
Plus set cubemap command needs six images, so i think it can be done in shader.


Thats all because DB easily can have this stupid feautures by defalt, but Lee says that time has not come( And many users must vote for any new feauture(((

HELP! (btw this is useful research for EVERYONE who in shaders)
sorry for my English

Lee Bamber is so~o swett'n'cool desu nya ^^

Login to post a reply

Server time is: 2024-11-28 00:08:58
Your offset time is: 2024-11-28 00:08:58