Gamestudio Links
Zorro Links
Newest Posts
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
Z9 getting Error 058
by k_ivan. 06/10/26 14:38
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (1 invisible), 1,229 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
1 model with 2 different materials in 2 views #123106
04/11/07 15:26
04/11/07 15:26
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
Well i have this model and i want it bumpmapped in view1 and let's say pure red in view2. Is this possible? I looked through the manual and came up with material.enable_tree .

My code:

Code:
 material mat_diff{
effect = "Diffuse.fx";
}

material mat_red{
effect = "red.fx";
}

function thevent(){
if(render_view == camera){my.material = mat_diff;}
if(render_view == depth_cam){my.material = mat_red;}
//if(render_view == camera){my.transparent = off;}
//if(render_view == depth_cam){my.transparent = on;}
return(0);
}

material mat_test{
flags = ENABLE_TREE;
event = thevent;


}

action render_entity{
my.material = mat_test;
}




When changing my.transparent = on/off, everything works fine. But as soon as i try to change the material, the model is either red or has diffuse lightning in both views. help ^^


Shade-C EVO Lite-C Shader Framework
Re: 1 model with 2 different materials in 2 views [Re: BoH_Havoc] #123107
04/11/07 17:02
04/11/07 17:02
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
ent_mtlset (ENTITY* entity,MATERIAL* material, var skin);
Replaces skin lighting and skin effect of a model


xXxGuitar511
- Programmer
Re: 1 model with 2 different materials in 2 views [Re: xXxGuitar511] #123108
04/11/07 18:57
04/11/07 18:57
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
When using ent_mtlset instead of "my.material = ..." i get a black screen and nothing happens. When commenting the 1st or 2nd "if(render_view..." out, i get ingame, but the material doesn't get changed.

My guess by now is, that it isn't possible to use 2 different shaders for 2 views (shader1 for view1 and shader2 for view2) for one entity. Can someone confirm this?

The thing is, i need this stuff to render a depthmap in view2 and then use it for a DoF shader. Both the depthmap-shader and DoF-shader are working, but i can't get it to work that an entity renders different in 2 views.

Last edited by BoH_Havoc; 04/11/07 18:57.

Shade-C EVO Lite-C Shader Framework
Re: 1 model with 2 different materials in 2 views [Re: BoH_Havoc] #123109
04/11/07 19:04
04/11/07 19:04
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Hm..

I've used my.material = xxx to change materials before during runtime. But I havn't had to do it between renders...

Are you sure that it wasn't working correctly?


xXxGuitar511
- Programmer
Re: 1 model with 2 different materials in 2 views [Re: xXxGuitar511] #123110
04/11/07 19:06
04/11/07 19:06
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Ah, haha...

I found the error...


theevent() sets the models material to mat_diff.red - therefore, it's material is NO LONGER mat_test. So therefore theevent() is no longer triggered!

So you just need to add the same flags/event you used in mat_test to the other two materials


xXxGuitar511
- Programmer
Re: 1 model with 2 different materials in 2 views [Re: xXxGuitar511] #123111
04/11/07 19:34
04/11/07 19:34
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
YEAH! That's it =) It works!

Exspect a real Depth of Field Shader very soon


Shade-C EVO Lite-C Shader Framework

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1