Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 609 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
ent_decal and particle material V7.10 #221213
08/12/08 19:59
08/12/08 19:59
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
Hi conitec,

I create a decal in a while (1) loop for visualising a mouse selection radius. I use this code:

Code:
			vec_set(temp_vec,camera.x);
		   vec_set(temp2_vec,mouse_dir3d);
         vec_scale(temp2_vec,5000);
         vec_add(temp_vec,temp2_vec);
         you = NULL;
			result = c_trace(camera.x,temp_vec,IGNORE_YOU|IGNORE_PASSABLE|USE_POLYGON | SCAN_TEXTURE);
			if (you != my || result == 0) { wait(1); continue; }
			my_pp = ent_decal(my,sel_rad,pencil_vars[0],0); my_pp.lifespan = 0.001;
			my_pp.material = decal_mat;
 

my_pp is a local PARTICLE* pointer.
decal_mat looks like this:
Code:
 MATERIAL* decal_mat = {
	ambient_red = 255;
	ambient_green = 255;
	ambient_blue = 255;
} 


I create the decals on a terrain that uses a multitexturing shader. At the beginning of my test the decal looks all right. Then I change the shader of the terrain (it's cloned by the way) using effect_load on the terrain's material (not on decal_mat of course). Once I do this the decals are always created with the terrain's shader settings applied (it even uses their mtlskins) altough every decal is given the decal_mat as material at the creation. I have particle_mode at 8.

Last edited by RedPhoenix; 08/12/08 20:00.
Re: ent_decal and particle material V7.10 [Re: RedPhoenix] #221257
08/13/08 06:12
08/13/08 06:12
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
If it's an internal effect assigned in MED to the terrain skin, it will override the effect from the decal material - same behavior as the entity material. But I don't know how this could be affected by effect_load.

I'd need to look into your project to find out what's happening.

Re: ent_decal and particle material V7.10 [Re: jcl] #221277
08/13/08 08:32
08/13/08 08:32
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
Ok I will send the project to the support. It's not a shader that is assigned in med to the terrain, the shader is created by script at runtime. But there might be various reasons for the problem as there are done several things besides effect_load (eg. I change the material skins of the terrain, assign new skins using ent_setskin etc.).

Re: ent_decal and particle material V7.10 [Re: RedPhoenix] #221279
08/13/08 09:35
08/13/08 09:35
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
If you're using ent_mtlset somewhere, the reason of the problem is clear. ent_mtlset sets a skin material that overrides the entity and decal material.

Re: ent_decal and particle material V7.10 [Re: jcl] #221306
08/13/08 12:50
08/13/08 12:50
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
No the material is always the same for each entity. Only the shader and skins (of the entity material) are changed. The decal material is only set when creating it and not changed or edited in any way.

Re: ent_decal and particle material V7.10 [Re: RedPhoenix] #221326
08/13/08 14:00
08/13/08 14:00
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, then I'd need your project. I'll look for the problem when you send it to the support.

Last edited by jcl; 08/13/08 14:00.
Re: ent_decal and particle material V7.10 [Re: jcl] #223993
08/27/08 22:26
08/27/08 22:26
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
I am having a similar problem with the decals. I'm using the latest beta(7.25), but my decals remain black no matter what. It doesn't apply the material I am setting to the decal. I'm not using mtl_set or effect_load. This is how I apply my effects:

if(lightmap_level == 1){road_shader.effect = "multitex4_ps1_0sha.fx";}
if(lightmap_level != 1){road_shader.effect = "multitex4_ps1_0ans.fx";}

Although, this shouldn't matter, since the decals are being applied long after any shaders are set to the world geometry.


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: ent_decal and particle material V7.10 [Re: William] #224053
08/28/08 08:45
08/28/08 08:45
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
That's a text string, not an effect. You can read in the manual how to apply effects:

http://manual.conitec.net/Shader-effect_load.htm

Re: ent_decal and particle material V7.10 [Re: jcl] #224075
08/28/08 12:08
08/28/08 12:08
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Huh, that's an effect. It's just setting those shaders to the material.

MATERIAL* road_shader = {}


function shader_static()
{
my.material = static_shader;

if(lightmap_level == 1){static_shader.effect = "multitex4_ps1_0sha.fx";}
if(lightmap_level != 1){static_shader.effect = "detail_staticmesh.fx";}

static_shader.ambient_red = static_ambient.x;
static_shader.ambient_blue = static_ambient.y;
static_shader.ambient_green = static_ambient.z;

static_shader.diffuse_red = static_diffuse.x;
static_shader.diffuse_blue =static_diffuse.y;
static_shader.diffuse_green = static_diffuse.z;
}

This works the same as effect_load(), with the difference of it being more flexible. Although, I don't see what this has to do with the decal material not working properly, and this code is just for the ground anyways.

Here is the decal code:


vec_set(trace_height.x,vector(0,0,0)); vec_add(trace_height.x,my.x); //initial trace detects for walls/terrain
//target = 0; vec_set(temp_vec, you.x); temp_vec.z -= 4000;
trace_height.z += 20;// effect_local(exhuast2, 12*time_step+1, trace_height.x, nullvector);

vec_set(temp_vec.x,vector(0,0,-35000)); vec_add(temp_vec.x,my.x); //initial trace detects for walls/terrain

result = c_trace(trace_height.x, temp_vec.x, IGNORE_ME+IGNORE_SPRITES+IGNORE_PASSABLE+USE_POLYGON+IGNORE_PASSENTS+ SCAN_TEXTURE);
//result -= 20;

if(you != NULL)
{
PARTICLE *par;
par = ent_decal(you, d_shadow, 0, my.pan - you.pan);

par.material = mat_model;
set(par, TRANSLUCENT);
par.alpha = 70;
par.lifespan = 0.001;
}


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: ent_decal and particle material V7.10 [Re: William] #224079
08/28/08 12:22
08/28/08 12:22
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, now please let's not get a mess in this thread. The original poster posted a bug report and your problem seems to be how to set an effect.

For applying an effect to a material please read the manual under the link that I gave above. Your function above won't work as a replacement for effect_load(). An effect is a .fx file on your hard disk that must be really loaded. What you're doing was just setting the file name as a text string. Please use effect_load() and if you then have a problem with the decal effect, please post again. We might then need your project for reproducing the problem.


Page 1 of 2 1 2

Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | 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