[help] Rendering a model fullbright Created 2 years ago2021-09-12 19:28:28 UTC by Petko Petko

Created 2 years ago2021-09-12 19:28:28 UTC by Petko Petko

Posted 2 years ago2021-09-12 19:28:28 UTC Post #345927
I need some help with making a specific entity's model always render fullbright, I
alredy tried poking around with that StudioModelRenderer.cpp, but im pretty sure
it needs OpenGL code to work, can someone please help me with this?

(Just to be clear, im not trying to implement a working fullbright flag, im just trying to
make a specific entity's model always render fullbright)

Thanks for reading!
Posted 2 years ago2021-09-15 14:52:07 UTC Post #345934
One hacky way would be to render the model black (render it with regular diffuse lighting, with 0 0 0 for the light sample colour, which it'd normally pick up from the ground or ceiling), then render it again with the additive render mode. It's been a while since I looked at the studio model renderer stuff, but I'll try to get a better answer tonight.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-09-15 17:53:25 UTC Post #345935
You can set the light sample colour and value around line 1240 in StudioModelRenderer.cpp:
lighting.plightvec = dir;
// After StudioDynamicLight is called, lighting is initialised
IEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting );

// We can then begin changing it around
lighting.ambientlight = 0;
lighting.shadelight = 0;

// The rest will apply the lighting onto the model
IEngineStudio.StudioEntityLight( &lighting );
I believe you could, maybe, somehow modify lighting to get fullbright...
digs around a little bit
WOO! I was silly all along. You could just set ambientlight to 255 and shadelight to 0.
This scientist is afraid of his own brightnessThis scientist is afraid of his own brightness
So yea, the code just becomes:
lighting.plightvec = dir;
IEngineStudio.StudioDynamicLight(m_pCurrentEntity, &lighting );

// Fullbright
lighting.color = Vector( 1.0f, 1.0f, 1.0f );
lighting.ambientlight = 255;
lighting.shadelight = 0;

IEngineStudio.StudioEntityLight( &lighting );
Now, the only thing left to do is to check whether it's a specific entity or not. I guess you can check if m_pCurrentEntity->index is a certain number or something like that. Or, even better, add a special render FX value for that. :)
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-09-15 18:20:18 UTC Post #345936
@Admer456
Thanks Admer, this helped alot, I think I might post the results
Posted 2 years ago2021-12-20 23:04:05 UTC Post #346145
The studio.h that ships with the latest SDK has a STUDIO_NF_FULLBRIGHT flag. I haven't tried it to see if the engine supports it but if it does you could IEngineStudio.SetForceFaceFlags( STUDIO_NF_FULLBRIGHT ); in StudioModelRenderer
Posted 2 years ago2021-12-24 04:50:04 UTC Post #346158
I tried the STUDIO_NF_FULLBRIGHT flag but that didn't seem to work - I thought I'd discussed it with someone and it worked in Half-Life.
Posted 2 years ago2021-12-24 23:29:07 UTC Post #346159
That flag only works in Sven Co-op. It's not implemented in vanilla Half-Life.
Posted 2 years ago2022-01-23 02:12:29 UTC Post #346218
Yes I think you're right - I could have sworn that an extra one of those texture flags was secretly usable but I can't remember where I saw that.
You must be logged in to post a response.