Forum

Attachments with shadows? (DarkPlaces)

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Attachments with shadows? (DarkPlaces)

Postby jim » Sat Jan 05, 2008 6:30 pm

I'm wondering if there's any way to get shadows for attachments. If I attach a model with setattachment, it doesn't cast any shadows: like this

This same error happens with r_shadows 1 and no real time shadows. The screenshot is with real time shadows.
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Re: Attachments with shadows? (DarkPlaces)

Postby LordHavoc » Sat Jan 05, 2008 9:30 pm

jim wrote:I'm wondering if there's any way to get shadows for attachments. If I attach a model with setattachment, it doesn't cast any shadows: like this

This same error happens with r_shadows 1 and no real time shadows. The screenshot is with real time shadows.


This usually means you have some transparent pixels in the model skin and thus it never casts shadows, but this one does not appear to be rendered by the (quite poor) transparency renderer, so that can't be it.

The shadowing system really has no idea what an attachment is, it shouldn't care at all.

I'll need to test this myself to debug it.

Could you supply the mod for testing purposes? (doesn't matter if it's terribly incomplete or whatever, just that I can easily get a test case running)
LordHavoc
 
Posts: 322
Joined: Fri Nov 05, 2004 3:12 am
Location: western Oregon, USA

Postby jim » Sun Jan 06, 2008 12:15 am

I just noticed they don't make shadows, because the attachments are doublesided. If I take away this line, shadows will be shown:
Code: Select all
self.weaponent.effects = self.weaponent.effects | EF_DOUBLESIDED;


It also made the character not cast shadows, if I added the effect for it.

I used the doublesided effect, because the weapons actually have some transparent effect models part of them, like here: http://koti.mbnet.fi/jeejeeje/wip/gang_02.jpg

I was a bit lazy on the export stuff, so I just had the effects in the same dpm file and then I just have two .skin files with one setting the effect texture to "common/nodraw". I think I'll just export things again and now have the effects separate from the weapon...
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby LordHavoc » Mon Jan 07, 2008 6:39 pm

jim wrote:I just noticed they don't make shadows, because the attachments are doublesided.


Ahh yes, I still need to make doublesided objects cast shadows, I keep forgetting about this (partly because doublesided opaque objects are a rarity).

jim wrote:I was a bit lazy on the export stuff, so I just had the effects in the same dpm file and then I just have two .skin files with one setting the effect texture to "common/nodraw". I think I'll just export things again and now have the effects separate from the weapon...


Nah, just make a q3 shader for the second material:
Code: Select all
progs/club/rings
{
        cull disable
        {
                map progs/club/rings.tga
                rgbGen identity
        }
}


That ought to work (tweak the paths as appropriate - the first line is the name of the texture this shader overrides, and the map command is the texture to use instead - you can use animmap to make it animate between several images at a specified framerate).

The rgbGen identity should make it fullbright, and the cull disable makes it double sided (like EF_DOUBLESIDED, but just for this one material), you can throw in other things like "blendfunc add" for EF_ADDITIVE style rendering or "blendfunc blend" for an alpha blend in the inner parentheses.

There are a lot of other things that can be done with q3 shaders of course, like tcmod scroll 1 0 would make it scroll the texture in one direction.
LordHavoc
 
Posts: 322
Joined: Fri Nov 05, 2004 3:12 am
Location: western Oregon, USA

Postby jim » Wed Jan 09, 2008 12:25 am

Aah, these Q3 shaders sound interesting. I'll have to find more about these... Do they also work for level textures? Do they also work for levels that are in Q1 format? I've thought of using that, because Q3 level format don't like flickering lights...

I'll look more into the shaders tomorrow...
zbang!
User avatar
jim
 
Posts: 599
Joined: Fri Aug 05, 2005 2:35 pm
Location: In The Sun

Postby LordHavoc » Wed Jan 09, 2008 12:44 am

jim wrote:Aah, these Q3 shaders sound interesting. I'll have to find more about these... Do they also work for level textures? Do they also work for levels that are in Q1 format? I've thought of using that, because Q3 level format don't like flickering lights...

I'll look more into the shaders tomorrow...


Yep, supported on everything except sprites in DP - sprites have been a low priority, they have a special renderer and no one seems to have a need for shaders on them - partly because q3 shaders have "deformvertexes autosprite" and "deformvertexes autosprite2" which make 4-point polygons in models/levels behave like billboard/directional-billboard sprites.

As for flickering in Q3BSP - yes, that's a format limitation, I haven't implemented RavenBSP support which is Q3BSP with lightstyles added (it's difficult to support with all the DP features).

You can still place rtlights in the ingame light editor and mark them as visible in normal lightmapped mode though.
LordHavoc
 
Posts: 322
Joined: Fri Nov 05, 2004 3:12 am
Location: western Oregon, USA


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest