Forum

v_weapon shader not working

Discuss the creation of various model formats for Quake engines, and related matters to modeling.

Moderator: InsideQC Admins

v_weapon shader not working

Postby Ghost_Fang » Mon Feb 27, 2012 7:55 am

So i've been (trying) to mess with shaders and so far no luck at all. I searched for hours for documentation or examples, mostly 404's or megaupload links. All i want is a simple reflection and/or refraction on my v_weapon like v_weapon in this video:
http://www.youtube.com/watch?feature=pl ... A6nJOCdJrM

But i can't seem to get it to work
My weapon path is: id1/progs/v_nail.mdl
I also have progs/v_nail.mdl_0.tga and progs/v_nail.mdl_0_norm.tga
I have also enabled r_water

Here is my shader:
Code: Select all
progs/v_nail.mdl_0
{
   {
   map progs/v_nail.mdl_0.tga
   rgbGen lightingDiffuse
        }
   dp_reflect 2 1 1 1 0.8
}


Is there anything else i have to have enabled? I tried Full Lighting setting as well.
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: v_weapon shader not working

Postby Seven » Mon Feb 27, 2012 12:46 pm

Hello Ghost_fang,

some month ago, this was a big subject over at quakeone.com.

I made a downloadeable version of what you intend to do:
http://quakeone.com/forums/quake-mod-re ... ing-2.html
Please read the linked post and find the download a little deeper on that page.

You will find the shader + textures inside the zip file.
I hope it will help you a little bit.

There are very nice tutorial sites available for shaders.
The one at dpwiki will explain the dp-specific shaders:
http://dpwiki.slipgateconstruct.com/ind ... ion_for_DP
The one from nexuizninjaz for standard Q3 shaders (be aware that not all of them work in DP):
http://toolz.nexuizninjaz.com/shader/

Regarding your attempt to use dp_reflect on models:
This does not work at the moment in DP.
You can use dp_reflect/dp_refract on world textures just fine, but not on model textures:
Nahuel even made an amazing mirror, using dp_reflect on meshes:
http://www.youtube.com/watch%3Fv%3D8t9_ ... i9f_x68IwA

For models (just like the weapon for example) you need to use dpreflectcube shader to get the visual you want.
This shader does not reflect the real world around you. But it will give you a quite similar effect, using a cubemap.
This is a WIP clip I made:
http://www.youtube.com/watch%3Fv%3DDA5C ... ONc7gSgw3g

You will find many downloads in the above linked thread (see also post #1) with nice ideas and realization of shaders in DarkPlaces.
That thread was really fun to participate. It brought many nice things to live.
In the end, webangle made a compilation thread with a major release:
http://quakeone.com/forums/quake-mod-re ... rload.html

Have fun, playing around with shaders.
Kind regards,
Seven
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: v_weapon shader not working

Postby leileilol » Mon Feb 27, 2012 2:01 pm

never ever ever ever ever ever ever ever ever ever ever ever ever ever use dp_reflect shaders on models
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: v_weapon shader not working

Postby Nahuel » Mon Feb 27, 2012 6:05 pm

leileilol wrote:never ever ever ever ever ever ever ever ever ever ever ever ever ever use dp_reflect shaders on models

why ?? whats the problem?? fps drop?
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: v_weapon shader not working

Postby toneddu2000 » Mon Feb 27, 2012 9:20 pm

yes, why? I also would like to know what could happen? It won't work?It has performance issues? There any chances it will be implemented?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1388
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: v_weapon shader not working

Postby leileilol » Tue Feb 28, 2012 12:20 am

yeah and it'll double the stupid when you leave a water reflection area since suddenly the gun will stop shining
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: v_weapon shader not working

Postby Ghost_Fang » Tue Feb 28, 2012 1:27 am

Seven wrote:Hello Ghost_fang,

some month ago, this was a big subject over at quakeone.com.

I made a downloadeable version of what you intend to do:
http://quakeone.com/forums/quake-mod-re ... ing-2.html
Please read the linked post and find the download a little deeper on that page.

You will find the shader + textures inside the zip file.
I hope it will help you a little bit.

There are very nice tutorial sites available for shaders.
The one at dpwiki will explain the dp-specific shaders:
http://dpwiki.slipgateconstruct.com/ind ... ion_for_DP
The one from nexuizninjaz for standard Q3 shaders (be aware that not all of them work in DP):
http://toolz.nexuizninjaz.com/shader/

Regarding your attempt to use dp_reflect on models:
This does not work at the moment in DP.
You can use dp_reflect/dp_refract on world textures just fine, but not on model textures:
Nahuel even made an amazing mirror, using dp_reflect on meshes:
http://www.youtube.com/watch%3Fv%3D8t9_ ... i9f_x68IwA

For models (just like the weapon for example) you need to use dpreflectcube shader to get the visual you want.
This shader does not reflect the real world around you. But it will give you a quite similar effect, using a cubemap.
This is a WIP clip I made:
http://www.youtube.com/watch%3Fv%3DDA5C ... ONc7gSgw3g

You will find many downloads in the above linked thread (see also post #1) with nice ideas and realization of shaders in DarkPlaces.
That thread was really fun to participate. It brought many nice things to live.
In the end, webangle made a compilation thread with a major release:
http://quakeone.com/forums/quake-mod-re ... rload.html

Have fun, playing around with shaders.
Kind regards,
Seven




Hahahah Seven, I was all over those topics and related ones and anything linked to those. I never read anywhere that you could use dp_reflect on models though, but thanks to your file I had an accurate shader to go off of, All the ones I found were for map textures so i wasnt entirely sure. But thanks a lot it looks good! (great when i make a real cubemap)

leileilol wrote:never ever ever ever ever ever ever ever ever ever ever ever ever ever use dp_reflect shaders on models

Sooo I should NOT use dp_reflect on models? Or is it acceptable sometimes? :P Is that what you're trying to say?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: v_weapon shader not working

Postby Ghost_Fang » Wed Feb 29, 2012 12:04 pm

I'll just recycle this topic for a related question: Is there a way to make the dpreflectcube change for each map? So the cubemap is accurate in relation to the map its projecting?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: v_weapon shader not working

Postby Seven » Wed Feb 29, 2012 12:53 pm

Hello Ghost_fang,

in fact you need a different cubemap for every inch of a map.
You can save a cubemap-set in any point of a map.
So the cubemap-set will only fit for exactly this position.
If you move 1 meter forward, it is already "wrong".

That is why it is important to find a cubemap-set (or even better to make a cubemap-set texture by yourself with a texture program)
that is kind of "universal".
Not too strong colors of entities... and such.

But anyhow, the surface of your wepaon is so round and small that you hardly will recognize a detail
on the cubemaps.
So only for big surfaces (and flat ones) you would recognize where it has been saved/created.

Nahuel made an very interesting dpreflectcube enforcer skin.
His visor used a cubemap. That looked fantastic.
But you could see that the cubemap showed E1M1 start position (of course only when going very near the enforcer with "notarget").
But the idea itself is great.

You dont have a performance drop by using dpreflectcube. You even dont need r_water 1.
But the effect is for small surfaces very similar to dp_reflect (which is performance heavy).
dp_reflect on mosaic windows or monitor textures in base maps looks sweet (cause you can see yourself and the world in realtime).


Back to your question:
You could maybe with an QC hack change the weapon model depending on map name in: W_SetCurrentAmmo() using copies of orig models.
Then you can make shaders incl. cubemaps for different maps fitting to the new children of weapon model names/textures.
If that is what your questions was.
Something that should not be done of course...!
Code: Select all
...
else if (self.weapon == IT_SHOTGUN)
   {
      self.currentammo = self.ammo_shells;
if (world.model == "maps/e1m1.bsp")
      self.weaponmodel = "progs/v_shot01.mdl";
else if (world.model == "maps/e1m2.bsp")
      self.weaponmodel = "progs/v_shot02.mdl";
else if (world.model == "maps/e1m3.bsp")
      self.weaponmodel = "progs/v_shot03.mdl";
else if (world.model == "maps/e1m4.bsp")
      self.weaponmodel = "progs/v_shot04.mdl";
else
      self.weaponmodel = "progs/v_shot.mdl";
      self.weaponframe = 0;
      self.items = self.items | IT_SHELLS;
   }
   else if (self.weapon == IT_SUPER_SHOTGUN)
   {
...


That is just a stupid idea of course. My knowledge is very limited.
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: v_weapon shader not working

Postby Ghost_Fang » Wed Feb 29, 2012 9:42 pm

Seven wrote:Hello Ghost_fang,

in fact you need a different cubemap for every inch of a map.
You can save a cubemap-set in any point of a map.
So the cubemap-set will only fit for exactly this position.
If you move 1 meter forward, it is already "wrong".

That is why it is important to find a cubemap-set (or even better to make a cubemap-set texture by yourself with a texture program)
that is kind of "universal".
Not too strong colors of entities... and such.


Yea I know that much, I knew that I was going to have to make a very generic/universal cubemap for the map because it would only
be 100% accurate if I stand where I made the cubemap.

Seven wrote:Back to your question:
You could maybe with an QC hack change the weapon model depending on map name in: W_SetCurrentAmmo() using copies of orig models.
Then you can make shaders incl. cubemaps for different maps fitting to the new children of weapon model names/textures.
If that is what your questions was.
Something that should not be done of course...!
Code: Select all
...
else if (self.weapon == IT_SHOTGUN)
   {
      self.currentammo = self.ammo_shells;
if (world.model == "maps/e1m1.bsp")
      self.weaponmodel = "progs/v_shot01.mdl";
else if (world.model == "maps/e1m2.bsp")
      self.weaponmodel = "progs/v_shot02.mdl";
else if (world.model == "maps/e1m3.bsp")
      self.weaponmodel = "progs/v_shot03.mdl";
else if (world.model == "maps/e1m4.bsp")
      self.weaponmodel = "progs/v_shot04.mdl";
else
      self.weaponmodel = "progs/v_shot.mdl";
      self.weaponframe = 0;
      self.items = self.items | IT_SHELLS;
   }
   else if (self.weapon == IT_SUPER_SHOTGUN)
   {
...


That is just a stupid idea of course. My knowledge is very limited.


Yea I was afraid of that, I kinda don't want to do that with a 2500 tris/180 frames weapon :/
Thanks anyways!
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am


Return to Modeling

Who is online

Users browsing this forum: No registered users and 1 guest