1 registered members (AndrewAMD),
677
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: can't tint model red cause of shader
[Re: 3run]
#447936
01/13/15 16:17
01/13/15 16:17
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
I'll try to do some tests on my side. The easiest way to handle this without shader stuff, is to reset the material to 'mtl_model' and then change colors, just as I've thought. And it's working, probably you've made some kind of a mistake on your side. Here is a working script (you'll need 'box.mdl' from 'shadertest' project in Acknex's root folder):
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>
void main(){
level_load("");
wait(3);
sun_light = 100;
vec_set(camera.x, vector(117, 224, 74));
vec_set(camera.pan, vector(240, -18, 0));
ENTITY* ent = ent_create("box.mdl", nullvector, NULL);
ent.material = mtl_specBump;
while(1){
sun_angle.pan += 5 * time_step;
sun_angle.tilt += 5 * time_step;
draw_text("press space to turn into devil cube!", 10, 10, COLOR_WHITE);
if(key_space){break;}
wait(1);
}
ent.material = mtl_model;
set(ent, LIGHT | UNLIT); // UNLIT here is to make it's color more visible
vec_set(ent.blue, COLOR_RED);
while(!key_enter){
draw_text("press enter to turn into normal cube!", 10, 10, COLOR_WHITE);
wait(1);
}
reset(ent, LIGHT | UNLIT);
vec_set(ent.blue, COLOR_GREY);
ent.material = mtl_specBump;
while(1){
sun_angle.pan += 5 * time_step;
sun_angle.tilt += 5 * time_step;
wait(1);
}
}
You maybe could play with 'emissive' colours of the shader, but that will make all other entities with that material red. Greets
|
|
|
Re: can't tint model red cause of shader
[Re: Reconnoiter]
#447943
01/13/15 18:34
01/13/15 18:34
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
just append a to your diffuse textur sampling in the shader and declare vecColor as a float4 shader variable. There you go PS.: Could be vecLight as well, can't remember it right
Last edited by MasterQ32; 01/13/15 19:25.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|