cast shadows over md3 surfaces (surface using a shader)


(sick2012) #1

Hi,im trying to cast shadows over md3 surfaces and cant get it right. here is what i got:

  1. is a brush using the shader “A”
  2. is a md3 (misc_model) using the shader “B”
  3. is a md3 (misc_model) using the shader “A”

the number two model it looks a bit better than 3, but is not even close to number 1. i hope yu can help me =).


here are the shaders
SHADER “A”-------------------------------------------------

textures/base_support/x_support
{
surfaceparm trans
surfaceparm alphashadow
cull none
{
map textures/base_support/x_support.tga
blendFunc GL_ONE GL_ZERO
alphaFunc GE128
depthWrite
rgbGen identity
}
{
map $lightmap
rgbGen identity
blendFunc filter
depthFunc equal
}
}

SHADER “B”------------------------------------------
textures/builds/support
{
cull none
surfaceparm alphashadow
{
map textures/builds/support.tga
blendFunc GL_ONE GL_ZERO
alphaFunc GE128
depthWrite
}
{
map $lightmap
blendFunc filter
rgbGen identity
depthFunc equal
}
}


(carnage) #2

are you using misc_model or misc_gamemodel

misc_gamemodel is lit by the lightgrid and wont have shadows. i belive misc_gamemodel is bakes into the bsp so will have its own lightmap

you have also not said witch model is using witch shader making it hard to see. number 1 does have shdows on it and i think you might find that its only so dark because of the lighting conditions in ur map


(nUllSkillZ) #3

Aren’t there some entity keys?
Can’t remember.


(Shaderman) #4

For misc_models there are

_castshadows / _cs:
Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.

_receiveshadows / _rs:
Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. 1 = receive shadows ONLY from corresponding keyed entities.

_lightmapscale:
Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).


(sick2012) #5

yea number 1 is a brush so is ok is just for comparison with the md3s, i want the md3s look like number 1.


(carnage) #6

it looks to be a fairly simple shape and hardly worth making a misc_model since it would be baked into the map like brushwork (or very similar anyway) so why go to all the trouble of making it seperate model


(sick2012) #7

well i think its obvius that the image is a testmap. and the shape or simplicity of the model is not the point of this thread.

anyways, today i tried something new, i put a model in a room with a flickering lightstyle, and the model it appeared all black. (the model was a simple gargoyle without any shader). have any of you tried that?.

so im wonder what kind of limitations have a misc_model or md3?. gonna post some screenshots later.


(pazur) #8

I never had problems to light my models. In my JK3:JA map I even had terrain that was a model. Other models and brushes casted nice shadows on it. I used ASE to load the model and a more or less standard lightmap shader.

Maybe it`s the surfaceparm alphashadow that causes the trouble when it is supposed cast shadows on itself?

Here the terrain shader from my JK3:JA map Skytemple:


models/pazur/grass_bright1
{
    qer_editorimage models/pazur/grass_bright1.tga
    q3map_nonplanar
	q3map_forcemeta
	q3map_clipmodel
	q3map_splotchfix

	q3map_material	ShortGrass

	q3map_normalimage models/pazur/grass_bright1_nm.tga
    q3map_lightmapsamplesize 4
    q3map_shadeAngle 120
    q3map_lightmapaxis z
    q3map_lightmapsampleoffset 8.0

    q3map_tcMod rotate 33
    q3map_tcGen ivector ( 512 0 0 ) ( 0 512 0 )

   	// q3map_surfacemodel <path to md3> <density in units> <odds of appearing> <min scale> <max scale> <min angle> <max angle> <oriented>
    q3map_surfaceModel models/pazur/grass.md3 16 0.001 0.5 3.0 0 360 0

   {
      map $lightmap
      rgbGen identity
   }
   {
   	 map models/pazur/grass_bright1.tga
  	 blendFunc GL_DST_COLOR GL_ZERO
  	 rgbGen identity
   }
}


(sick2012) #9

hey pazur thx for your comments, thats what i was expecting to hear from someone that works with them all the time, so i tho well maybe are my md3s, and i tried the standard md3s that there are in the pk3s files, and for my surprise they work fine, so its seems that the exporter of my milkshape to md3 is not working right, im wonder how this happened, im gonna try to fix this.


(IneQuation) #10

I believe it’s the other way around.


(carnage) #11

misc_gamemodel is lit by the lightgrid and wont have shadows. i belive misc_gamemodel is bakes into the bsp so will have its own lightmap

I believe it’s the other way around.

oh yeah that just me being stupid


(Hewster) #12

NPherno MD3 is a great app for fixing up “borked” md3’s, you can also use it
to change shader paths too… try it out :slight_smile:

http://www.planetquake3.net/download.php?op=fileid&lid=481

Hewster


(obsidian) #13

Have you tried MD3Fix?

By the way, how large is that model (height in game units)? MD3 has maximum bounding box limitiations.