add studio models normals for dynamic lighting

This commit is contained in:
Ivan 'provod' Avdeev 2021-03-08 09:54:26 -08:00
parent 47c3c4fa75
commit ea9b880865
3 changed files with 14 additions and 10 deletions

View File

@ -1,12 +1,8 @@
## 2021-03-06
- [x] (RTX; common) Staging vs on-GPU buffers
- [x] (RTX) BLAS construction on buffer unlock
- [x] (RTX) ray trace compute shader
- [x] dlight test
## 2021-03-08
- [x] studio models normals
- [ ] (RTX) geometry indexing
# Next
- [ ] studio models normals
- [ ] (RTX) geometry indexing
- [ ] (RTX) textures
# Planned
@ -104,3 +100,10 @@
## 2021-02-22
- [x] RTX: load extensions with -rtx arg
- [x] vk_render: buffer-alloc-centric upload and draw api
## 2021-03-06
- [x] (RTX; common) Staging vs on-GPU buffers
- [x] (RTX) BLAS construction on buffer unlock
- [x] (RTX) ray trace compute shader
- [x] dlight test

View File

@ -25,7 +25,7 @@ layout(location=4) in vec4 vColor;
layout(location=0) out vec4 outColor;
// FIXME what should this be?
const float dlight_attenuation_const = 10000.;
const float dlight_attenuation_const = 5000.;
void main() {
outColor = vec4(0.);
@ -39,7 +39,6 @@ void main() {
outColor.rgb += baseColor.rgb * texture(sLightmap, vLightmapUV).rgb;
for (uint i = 0; i < ubo.num_lights; ++i) {
// TODO use pos_r.w as radius
const vec4 light_pos_r = ubo.lights[i].pos_r;
const vec3 light_dir = light_pos_r.xyz - vPos;
const vec3 light_color = ubo.lights[i].color.rgb;

View File

@ -1960,6 +1960,7 @@ static void R_StudioDrawNormalMesh( short *ptricmds, vec3_t *pstudionorms, float
ASSERT((((vk_vertex_t*)vertex_lock.ptr) + vertex_lock.count) > dst_vtx);
VectorCopy(g_studio.verts[ptricmds[0]], dst_vtx->pos);
VectorCopy(g_studio.norms[ptricmds[0]], dst_vtx->normal);
dst_vtx->lm_tc[0] = dst_vtx->lm_tc[1] = mode == FAN ? .5f : 0.f;
// FIXME VK R_StudioSetColorBegin( ptricmds, pstudionorms );
dst_vtx->gl_tc[0] = ptricmds[2] * s;
@ -2163,9 +2164,10 @@ static void R_StudioDrawPoints( void )
float factor = (1.0f / 128.0f);
shellscale = Q_max( factor, RI.currententity->curstate.renderamt * factor );
R_StudioBuildNormalTable();
R_StudioGenerateNormals();
}
R_StudioGenerateNormals();
for( j = k = 0; j < m_pSubModel->nummesh; j++ )
{
g_nFaceFlags = ptexture[pskinref[pmesh[j].skinref]].flags | g_nForceFaceFlags;