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

Created 1 week ago2021-09-12 19:28:28 UTC by Petko Petko

Posted 1 week 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 4 days 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 4 days 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 4 days ago2021-09-15 18:20:18 UTC Post #345936
@Admer456
Thanks Admer, this helped alot, I think I might post the results
You must be logged in to post a response.