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.

Dark GDK / Dark Shader getting Camera position?

Author
Message
Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 17th Mar 2012 20:37 Edited at: 17th Mar 2012 20:50
How do I get the camera's position in DarkShader..

sorry if I posted this in the wrong place.

Could I inject a vector3 into a shader? and how..

is there a reference or some documentation
Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 17th Mar 2012 20:53 Edited at: 17th Mar 2012 23:34
Ok How do I make it so I can texture the object in GDK and use that texture with my shader, do I leave the resource name blank or what?

I leave it blank and I can apply the two texture to a sphere made with dbMakeObjectSphere, but I cant apply it to my custom objects.



My object code.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 18th Mar 2012 12:04 Edited at: 18th Mar 2012 12:04
Quote: "How do I get the camera's position in DarkShader.."

It should be something like:


(un-tweakeable)

Or you can feed the value to any custom float4 variable.

Quote: "I can apply the two texture to a sphere made with dbMakeObjectSphere, but I cant apply it to my custom objects."

Then revise how is your custom mesh built. FVF format and such.

Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 18th Mar 2012 17:33 Edited at: 18th Mar 2012 18:17
Thanks for the help, but can you be more specific when you say..

Quote: "Then revise how is your custom mesh built. FVF format and such."


please help me your my only hope.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 18th Mar 2012 20:37
Sorry I'm no expert in building meshes at runtime but I see in your code:


So, you know what you are doing, right?
Not really sure about if there is something missing

Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 18th Mar 2012 23:20
Quote: "Quote: "I can apply the two texture to a sphere made with dbMakeObjectSphere, but I cant apply it to my custom objects."
Then revise how is your custom mesh built. FVF format and such."

In case you need one uv coordinate set and want to use it with 2 textures then default fvf format is enough.
You have to specify 2 textures and 2 texture samples in shader and then get the pixel color from both textures in pixel shader and combine them into one color which will be returned from pixel shader. How will you combine them it's up to you, it depends on what effect you want to achieve: you can add them, you can multiply them, you can divide them, etc..

Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 19th Mar 2012 00:25
Ya I'm just not sure why its not working.
Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 19th Mar 2012 00:54
well, is your shader code correct? Because i can't tell either because all you posted is dark GDK code in which everything seems to be correct

Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 19th Mar 2012 01:17
O yeah it should be right It works in dark shader and on like a sphere made with dbMakeObjectSphere(doom,doom,doom,doom); lol;

Ill post it though lol, its like a light kinda and kinda bump mapping and kinda multi-texture kinda.

Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 19th Mar 2012 01:17 Edited at: 19th Mar 2012 01:20
Oops duplicate post o well Ill edit..

I edited the bump-glossy shader from nvidia cause I'm a shader noob. lol

[edit again] Oh ya don't steal it umm yeah
Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 19th Mar 2012 01:39
Well, does it work on your object or don't? I couldn't figure it out from your last 2 posts.
Texture are defined in the shader so you'll need to have rock.bmp and green.bmp in order it to work.

An there are lots of simpler shaders out there so you should have picked something simpler to edit

Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 19th Mar 2012 02:31
You should try it out Brendy boy.. Ill post the fx file, Ill make the resource name empty so you can use whatever for textures.

Attachments

Login to view attachments
Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 19th Mar 2012 03:00
Quote: "You should try it out Brendy boy.. "

i don't have dark gdk installed. If you save your object and post it here together with fx file i can try it in dbpro

Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 19th Mar 2012 03:18 Edited at: 19th Mar 2012 03:36
crap another post duplicate
Benjames8
14
Years of Service
User Offline
Joined: 6th Jan 2010
Location: Your Nightmares
Posted: 19th Mar 2012 03:36
I put the shader in my last post I haven't made a code for saving my object. It is actually many objects, this is so I can hide far sections of the caves.

if you test it on your own objects it should work or at least it will work on the primitives that you can create in darkbasic

Login to post a reply

Server time is: 2024-11-19 03:23:58
Your offset time is: 2024-11-19 03:23:58