Forum

Page 1 of 1

DarkPlaces - Model Shadows.

PostPosted: Tue Nov 15, 2011 3:05 am
by Qrv
Hello,

Here I have a few tree models, q3 format. As you can see, they load in-game fine, however, two main problems.

Image

Image

First thing to notice, the leaves are pretty fullbright. Here's the shader currently being played with for the leaves:

Code: Select all
models/mapobjects/oak/oakblaetter
{
   //cull none
   cull disable
   nopicmip
   dpshadow
   {
      map models/mapobjects/oak/oakblaetter.tga
      alphaFunc GE128
      //depthWrite
      //rgbGen vertex
      rgbGen lightDiffuse
   }
}


The comment out parts are from the original shader, as I've adjusted it some to how I understand the shader should be, for non-full bright leaves.

Also notice, that "dpshadow" is enabled in the shader, which leads me to my next issue.

In the second screenshot, you'l see a lack of shadows for leaves.
Although the second screenshot doesnt show it, with dpshadow enabled inside the shader, the leaves polygon casts shadows, ie, you get a square shaped shadow, not leaf shapes.

Can DarkPlaces not cast RT Shadows using the alpha layer of textures as a mask? And also, is there anyway to sort out the lighting for the leaves, so their not practically fullbright?




( DarkPlaces needs more, correct and up-to-date documentation. -.- )

Re: DarkPlaces - Model Shadows.

PostPosted: Tue Nov 15, 2011 11:06 am
by Nahuel
I do not understand many about shaders and darkplaces suppport. But for a texture with channel alpha this shader will work correctly (no fullbright) . Maybe this shader has innecesary lines :oops:, I do not know how works the "dpshadow".
Code: Select all
models/mapobjects/oak/oakblaetter
{   

   {
   map models/mapobjects/oak/oakblaetter
      blendFunc GL_ONE GL_ZERO
      alphaFunc GE128
      depthWrite
      rgbGen identity
   }

   {
         map $lightmap
         rgbGen identity
         blendFunc GL_DST_COLOR GL_ZERO
         depthFunc equal
   }

}


I do not know if darkplaces can cast shadows with a poligon with a texture with chanel alpha, or some transparency. I didnĀ“t get it at the time :)

Re: DarkPlaces - Model Shadows.

PostPosted: Tue Nov 15, 2011 12:01 pm
by Qrv
Hmm, thanks for that Nahuel, it's still not quite right. I'm starting to wonder if its just DarkPlaces and not the shader, prehaps my expectations for DP engine is a bit beyond what it can actually do, I dunno.

Image

Shader used:

Code: Select all
models/mapobjects/oak/oakblaetter
{
   cull none
   //cull disable
   //nopicmip
   //dpmeshcollisions
   //dpshadow
   {
      map models/mapobjects/oak/oakblaetter.tga
      blendFunc GL_ONE GL_ZERO
      alphaFunc GE128
      depthWrite
      //rgbGen vertex
      //rgbGen lightDiffuse
      rgbGen identity
   }
   
   {
      map $lightmap
      rgbGen identity
      blendfunc GL_DST_COLOR GL_ZERO
      depthFunc equal
   }
}



As for "dpshadow" in shaders, Nahuel, it's supposed to allow 'stuff' to cast shadows. One usage for it, is to allow invisible brushes to cast shadows.
Taken from the DP Wiki:

Code: Select all
textures/common/shadowmesh
{
 dpshadow
}


Such a shader should be invisible in-game, but cast shadows. I suppose it's there for strange circumstances, like to recreate the "Q" logo on the ground, in one of iD's maps, but the sky doesnt show the Q in brushes. I'm sure it can be pretty usefull with some imaginative usage. Theres also "dpnoshadow" you can stick in your shaders, to do the opposite. Cast no shadows.

Re: DarkPlaces - Model Shadows.

PostPosted: Tue Dec 27, 2011 7:23 pm
by Sami
Take a look at the alphashadow shader keyword - it should do what you want (i.e. use the alpha channel when working out shadows rather than the opaque polygons).

Re: DarkPlaces - Model Shadows.

PostPosted: Thu Dec 29, 2011 6:26 pm
by Qrv
I thought alphashadow only applied when using the standard q3bsp lightmapping?
If i recall correct, thats exactly what it's for.

Unless your telling me DP has something like dpalphashadow? I've never heard of such a thing, but alot of DP's stuff seems undocumented so, it might exist.

But the lighting im using here is the Real Time lighting within DarkPlaces, to get these shadows.