Tempust85 Posted September 11, 2014 Posted September 11, 2014 I'd like to request that stencil shadows to be fixed so it shades the model better. This is what we currently have in-game: I'm thinking gouraud shade the model as seen in cg_shadows 1, but project shadows from other objects (including its own body) onto it - if that makes sense. Bek likes this
Boothand Posted September 11, 2014 Posted September 11, 2014 Hmm, wouldn't the lightmap being baked into the level prevent shadows from objects from being cast onto the model?
Circa Posted September 11, 2014 Posted September 11, 2014 This is something that would be great in OpenJK. Tempust85 likes this
Tempust85 Posted September 12, 2014 Author Posted September 12, 2014 Yeah, especially since rend2 has no one working on it. @@Xycaleth @@ensiform ? Anyone? At least reply with a no, I don't like to be left hanging.
Xycaleth Posted September 12, 2014 Posted September 12, 2014 I've not implemented stencil shadows before so I can't make a guess as to why the shadowing looks like that. It should certainly be possible to fix it though. I've got a lot of unfinished things I need to do though (some kind of release for ModView being priority atm) so I don't have the time to look at it. Tempust85, Circa, Archangel35757 and 1 other like this
Tempust85 Posted October 11, 2014 Author Posted October 11, 2014 @@Xycaleth @@ensiform @@eezstreet Well this is interesting, I've accidently enabled stencil shadows for MD3 models: All I did was comment out the RF_SHADOW_PLANE line under R_AddMD3Surfaces in tr_mesh.cpp: // stencil shadows can't do personal models unless I polyhedron clip if ( !personalModel && r_shadows->integer == 2 && fogNum == 0 && (ent->e.renderfx & RF_SHADOW_PLANE ) && !(ent->e.renderfx & ( RF_NOSHADOW | RF_DEPTHHACK)) && shader->sort == SS_OPAQUE ) { R_AddDrawSurf( (surfaceType_t *)surface, tr.shadowShader, 0, qfalse ); } Thing is, I can't understand why commenting that one line out would suddenly enable the stencil shadows. I would think that having the line in there would enable the shadows, not disable them. Lancelot, Archangel35757, Stoiss and 2 others like this
Xycaleth Posted October 11, 2014 Posted October 11, 2014 Stencil shadows looks to be opt-in per ref entity. Commenting that out means all ref entities are opted in automatically (unless it doesn't match the other conditions). Tempust85 likes this
ensiform Posted October 11, 2014 Posted October 11, 2014 That only works on md3 models that are not in the bsp. Also, misc_model_static is explicitly marked as RF_NOSHADOW in MP. Where it is not in SP.
Archangel35757 Posted October 11, 2014 Posted October 11, 2014 But please raise the stencil shadow's 500 vertex limit to be 1000 vertices...
z3filus Posted October 11, 2014 Posted October 11, 2014 map objects (.md3) always cast a shadow when you set the shadows to /cg_shadows 3 ..i think that was the cmd in console so where is this " tr_mesh.cpp " located `?
ensiform Posted October 11, 2014 Posted October 11, 2014 But please raise the stencil shadow's 500 vertex limit to be 1000 vertices...Nope. Tied to overall limit of 1000.
ensiform Posted October 11, 2014 Posted October 11, 2014 map objects (.md3) always cast a shadow when you set the shadows to /cg_shadows 3 ..i think that was the cmd in console so where is this " tr_mesh.cpp " located `?Only ones that are not part of the bsp can be affected regardless of option.
Archangel35757 Posted October 11, 2014 Posted October 11, 2014 Nope. Tied to overall limit of 1000.It's a simple change to the formula-- just delete the divide by 2... no?
ensiform Posted October 11, 2014 Posted October 11, 2014 It's a simple change to the formula-- just delete the divide by 2... no?Nope. You think idsoftware put the division by 2 there just for the hell of it? It requires two times the amount of verts for shadows, ergo only 500 will be allowed for shadows to work. The / 2 exists in q3 as well.
Tempust85 Posted October 11, 2014 Author Posted October 11, 2014 I read a comment about vertex buffer or something which must be why they have the 500 limit on stencils. Doesn't matter anyways so long as your model has LODs, as there is code to switch to the models lowest LOD if LOD0 hits the 500 limit.
Xycaleth Posted October 11, 2014 Posted October 11, 2014 Stencil shadows are rendered by redrawing the model but with it "flattened" on to the ground, and this is done at the same time as the ordinary model is rendered. The maximum number of vertexes which can be rendered in one go is 1000, so with stencil shadows enabled, half the limit is allocated for the regular model render, the other half is used for the "flattened" model. This is where the division by two comes from.
Archangel35757 Posted October 12, 2014 Posted October 12, 2014 I read a comment about vertex buffer or something which must be why they have the 500 limit on stencils. Doesn't matter anyways so long as your model has LODs, as there is code to switch to the models lowest LOD if LOD0 hits the 500 limit.Stencil shadows are rendered by redrawing the model but with it "flattened" on to the ground, and this is done at the same time as the ordinary model is rendered. The maximum number of vertexes which can be rendered in one go is 1000, so with stencil shadows enabled, half the limit is allocated for the regular model render, the other half is used for the "flattened" model. This is where the division by two comes from.So are you saying that if LOD0 violates the 1000/2 (500) vertex limit the game automatically reverts to the next lower LOD to calculate stencil shadows???
Tempust85 Posted October 12, 2014 Author Posted October 12, 2014 From what I can gather, it uses the lowest LOD present.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now