Does Darkplaces have reflections?

Discuss the construction of maps and the tools to create maps for 3D games.
Post Reply
Mexicouger
Posts: 514
Joined: Sat May 01, 2010 10:12 pm
Contact:

Does Darkplaces have reflections?

Post by Mexicouger »

Does Darkplaces have real reflections of any kinds? Like setting a material to be able to reflect the environment or other entities? If so, How can it be done?
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: Does Darkplaces have reflections?

Post by leileilol »

Yes, and it's applied with commands in texture shader stages (scripts/blah.shader).
i should not be here
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Does Darkplaces have reflections?

Post by Seven »

Hello Mexicouger,

There are basically 2 different ways to bring reflections into Darkplaces:

1.) dpreflectcube shader
2.) dp_reflect shader

to 1.)
Pros:
- You can make single areas in one texture reflective.
- You dont need r_water enabled
- Works on world textures AND model textures
- As good as no performance impact
Cons:
- The reflection is only what the cubemap shows (NOT live/realtime; not a mirror)

to 2.)
Pros:
- The reflection is LIVE/Realtime ! That is why you see yourself or any other entity in it.
Cons:
- You cannot make single area of a texture reflective (only complete texture)
- You need r_water enabled
- Impacts performance (relatively to size of mirror)
- Works only on world textures (no models)


Examples for 1.)
http://www.youtube.com/watch?v=DA5CXg-wJM0

Examples for 2.)
http://www.youtube.com/watch?v=8t9_NhqTbgA
Image Image

Please read the dpwiki (now backedup on chip´s homepage) to read more details about these 2 shaders keywords:
http://www.quakewiki.net/darkplaces-wik ... on-for-dp/

I uploaded the files + shaders that were used in youtube clip no.1. So you can see an example how it is done.
There are also more links in its readme.txt to more examples:
https://rapidshare.com/files/760270292/ ... 0Seven.zip

For more downloadable examples of dp_reflect and dpreflectcube usage, please visit these quakeone.com threads:
here:
http://quakeone.com/forums/quake-mod-re ... cting.html
and here:
http://quakeone.com/forums/quake-mod-re ... rload.html

Best wishes,
Seven
Mexicouger
Posts: 514
Joined: Sat May 01, 2010 10:12 pm
Contact:

Re: Does Darkplaces have reflections?

Post by Mexicouger »

Thanks for your so helpful post Seven. It really helped!
In the shader for dpreflect, what does each parameter do? I failed to find documentation of each parameter.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Does Darkplaces have reflections?

Post by Seven »

Hello Mexicouger,

I knew that bad things will happen, when Erros´s dpwiki page goes down... :|
... and it happened.

Chip and Spirit were so kind and backed up what they found in google´s archive,
but this backup is not complete...
I can only hope that Error will come back one day and bring dpwiki back online.

Until that happens, here is the definition of dp_reflect:

Code: Select all

dp_reflect <distort> <r> <g> <b> <alpha>
The reflection is alpha blended on the texture with the given alpha, and modulated by the given color. distort is used in conjunction with the normalmap to simulate a nonplanar "water" surface.

Be aware, that you also have these shader options (which belong together in one family), incase you need one of those:
dp_refract
dp_water

Have fun,
Seven
Mexicouger
Posts: 514
Joined: Sat May 01, 2010 10:12 pm
Contact:

Re: Does Darkplaces have reflections?

Post by Mexicouger »

Thank you Again Seven. I fail to find documentation on dp_refract and dp_water as well. Mind explaining them a bit?
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Does Darkplaces have reflections?

Post by Seven »

Hello Mexicouger,

You already see what dp_reflect does.
The shader keyword dp_refract adds/makes the refraction to the texture.
And dp_water is a combination of both to get a realisitc water visual in DP.

Search for "Pretty Water" and you will have a downloadable example of how it works/looks in DP.
The latest release from Urre + zombie is V0.2 (which does not work with newer DP builds).
I kept this "Pretty water" pack updated and added some ideas to it.
You can download V0.55 from here:
http://quakeone.com/forums/quake-mod-re ... pdate.html


But as you noticed, my english is bad, so here is a clear definition what these shaders do:
Shader parameters for DP's own features:
- dp_reflect <distort> <r> <g> <b> <a>
Makes surfaces of this shader reflective with r_water. The reflection is
alpha blended on the texture with the given alpha, and modulated by the given
color. distort is used in conjunction with the normalmap to simulate a
nonplanar water surface.
- dp_refract <distort> <r> <g> <b>
Makes surfaces of this shader refractive with r_water. The refraction
replaces the transparency of the texture. distort is used in conjunction with
the normalmap to simulate a nonplanar water surface.
- dp_water <reflectmin> <reflectmax> <refractdistort> <reflectdistort> <refractr> <refractg> <refractb> <reflectr> <reflectg> <reflectb> <alpha>
This combines the effects of dp_reflect and dp_refract to simulate a water
surface. However, the refraction and the reflection are mixed using a Fresnel
equation that makes the amount of reflection slide from reflectmin when
looking parallel to the water to reflectmax when looking directly into the
water. The result of this reflection/refraction mix is then layered BELOW the
texture of the shader, so basically, it "fills up" the alpha values of the
water. The alpha value is a multiplicator for the alpha value on the texture
- set this to a small value like 0.1 to emphasize the reflection and make
the water transparent; but if r_water is 0, alpha isn't used, so the water can
be very visible then too.
Mexicouger
Posts: 514
Joined: Sat May 01, 2010 10:12 pm
Contact:

Re: Does Darkplaces have reflections?

Post by Mexicouger »

Thank you very much Seven. I now have a good understanding of this concept!
Post Reply