Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Nymphodora, AndrewAMD, TipmyPip, Quad, Imhotep), 847 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
shade-c EVO materials #472527
05/02/18 20:20
05/02/18 20:20
Joined: Mar 2018
Posts: 37
Blobfist Offline OP
Newbie
Blobfist  Offline OP
Newbie

Joined: Mar 2018
Posts: 37
Hello again,


sooooo, I found another problem with shade-c.
I can't seem to include materials (probably need to somehow register the material to shade-c first somehow):


Code:
MATERIAL* mtl_spectest=
{
	effect = "levelDefault.fx";//the default shader from shade-c EVO
}

action I_am_worth_a_shader_to()
{
	my.material = mtl_spectest;
	set(my, SHADOW);
}




The result without light:



The result with light:



And as a comparison,
The stone block is using the stone.fx shade from shade-c EVO which is manually added via WED, while the gun has it's material (look at code above) added via script.

Without light:



With light:



I have no idea whats going on laugh

Re: shade-c EVO materials [Re: Blobfist] #472536
05/03/18 13:39
05/03/18 13:39
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
I would advice to look into the shade examples.
Also please take a look into here ( many questions and problems have been answered.
Maybe u post your shadeC related stuff next time in this thread (if you want), this way all shadeC info is combined in one topic ):
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=460457#Post460457

Take a look in the common.h file. There ull find the implementation of fx files. You can of course create you own fx files. It depends on the fx file ure using which Skin is which map ( diff, normal, spec etc ).

example include of a normal specular material ( put the following into main.c for example ):
Code:
MATERIAL* mtl_mynormspec ={
	effect = "myownmat.fx"; // your fx file
	flags  = ENABLE_RENDER;
	event  = sc_materials_event;	
	power  = 20; // Play with this value
}



myownmat.fx file ( can do a lot of things in here normal, spec, glow etc ):
Code:
//------------------------------------------------------------------------------
//----- USER INPUT -------------------------------------------------------------
//------------------------------------------------------------------------------

//assign skins
#define SKIN_ALBEDO (skin1.xyz) //diffusemap
#define SKIN_NORMAL (skin3.xyz) //normalmap
#define SKIN_GLOSS (skin2.xyz) //glossmap


#define NORMALMAPPING //do normalmapping?
#define GLOSSMAP
//#define GLOSSSTRENGTH 1

#define NO_SKIN4


//------------------------------------------------------------------------------
// ! END OF USER INPUT !
//------------------------------------------------------------------------------

#include <scHeaderObject>
// <-
// insert custom code here
// ->
#include <scObject>

In this example the diffuse map is skin1, specular map is skin2 and normalmapping ist skin3. Change XYZ to w to use the alphachannel of your texture.

Finally add this to your Level object in WED:
Code:
action Anything_WED(){
   my.material = mtl_mynormspec;
}



Last edited by rayp; 05/03/18 14:00.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: shade-c EVO materials [Re: rayp] #472546
05/04/18 12:47
05/04/18 12:47
Joined: Mar 2018
Posts: 37
Blobfist Offline OP
Newbie
Blobfist  Offline OP
Newbie

Joined: Mar 2018
Posts: 37
That did the trick.

Code:
flags  = ENABLE_RENDER;
event  = sc_materials_event;




And thank you for the tip in how to make normal mapping working!

Re: shade-c EVO materials [Re: Blobfist] #472549
05/04/18 14:08
05/04/18 14:08
Joined: Mar 2018
Posts: 37
Blobfist Offline OP
Newbie
Blobfist  Offline OP
Newbie

Joined: Mar 2018
Posts: 37
For this one, I actually scanned through the entire thread you send me before I decided to ask again.

I made and shared a nice little flashlight code:
shade-c EVO Flashlight


It works just fine. However, The moment I show a weapon in front of the screen the light of the flashlight seems to be occasionally blocked:



This is how it suppose to look like:



Is there a way to have the HUD lighten up, while still not getting in the way of the flashlight?

Re: shade-c EVO materials [Re: Blobfist] #472550
05/04/18 14:34
05/04/18 14:34
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Like in real life grin

A simple way is to set the pos of your flashlight to the front of your gun. vec_for_vertex is very cool in this case. Open MED. Create a vertex in front of the gun model. Place the number of this vertex in vec_for_vertex.
edit: If the gun is all dark now u could create another light above the gun to "fake" it brighter (normal light with very low values, no Spotlight). If i remember right AMBIENT is not working with shadeC in this case.

In my project Player can modify weapons with flashlights. This way the flashlight-start-point is the real pos of the bulb then.
edit: And i remeber having the same design issues back then...soon ill rewrite my flashlight script, then i see if i used two lights or if i found another trick.

Last edited by rayp; 05/04/18 14:43.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: shade-c EVO materials [Re: rayp] #472557
05/04/18 18:57
05/04/18 18:57
Joined: Mar 2018
Posts: 37
Blobfist Offline OP
Newbie
Blobfist  Offline OP
Newbie

Joined: Mar 2018
Posts: 37
Like in real Life?!!!!

But... but... but I'm developing a game cry


I thought that might be the most plausible solution.
I was just hoping there were a possibility to set FLAGS or similar and Lights with ids to have certain lights react to certain objects.

Well...
Do you know where to get a simple flashlight model? grin

Re: shade-c EVO materials [Re: Blobfist] #472558
05/04/18 19:52
05/04/18 19:52
Joined: Mar 2018
Posts: 37
Blobfist Offline OP
Newbie
Blobfist  Offline OP
Newbie

Joined: Mar 2018
Posts: 37
I made sure that any current weapon the player holds is defined as the global ENTITY lightEnt.

Considering that, this is what I came up with:
Code:
if(current_weapon == 2)//gun
				{
					if(lightEnt)
					{
						VECTOR _p;
						vec_for_bone (_p, lightEnt, 176);
						vec_set (flashlight.x, _p.x); 
						flashlight.pan = camera.pan;
						flashlight.tilt = camera.tilt;
						sc_light_update(flashlight);
					}
				}


I set the flashlight.. light to this particular vertex point I created:



It does work, however the light constantly flickers:


Re: shade-c EVO materials [Re: Blobfist] #472560
05/04/18 21:02
05/04/18 21:02
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Might be a culling issue. You could try disabling culling for the light or increasing its "cull_factor" (or whatever it's called in lite-c)


POTATO-MAN saves the day! - Random
Re: shade-c EVO materials [Re: Kartoffel] #472569
05/05/18 13:30
05/05/18 13:30
Joined: Mar 2018
Posts: 37
Blobfist Offline OP
Newbie
Blobfist  Offline OP
Newbie

Joined: Mar 2018
Posts: 37
Well, you can set clipping..

Code:
set(weapon,CLIPPED);



Couldn't find any instructions that directly influence culling

Re: shade-c EVO materials [Re: Blobfist] #472570
05/05/18 13:59
05/05/18 13:59
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
CLIPPED is a read-only flag. There's a variable called clip_factor to manually size the clipping volume of an entity.

(also you'll have to do this for the light entity, not the weapon)


POTATO-MAN saves the day! - Random
Re: shade-c EVO materials [Re: Kartoffel] #472577
05/05/18 21:15
05/05/18 21:15
Joined: Mar 2018
Posts: 37
Blobfist Offline OP
Newbie
Blobfist  Offline OP
Newbie

Joined: Mar 2018
Posts: 37
It works better, but not quite.

I have 2 variations:

A: placing the light infront of the weapon:
Code:
if(lightEnt)
					{
						clip_factor = 0;
						set(flashlight,CLIPPED);
						VECTOR _p;
						vec_for_bone (_p, lightEnt, 176);
						vec_set (flashlight.x, _p.x); 
						flashlight.pan = camera.pan;
						flashlight.tilt = camera.tilt;
						sc_light_update(flashlight);
					}




B: do not edit the position of the lightsource
Code:
clip_factor = 0;
set(flashlight,CLIPPED);
vec_set(flashlight.x, camera.x);
flashlight.z = camera.z;
flashlight.pan = camera.pan;
flashlight.tilt = camera.tilt;
sc_light_update(flashlight);




Both versions work equally "good" (less bad). Meaning that they rarely flicker. But sometimes no spotlight can be seen for a few seconds.
I doesn't seem to make a difference whether the light source is in front of the weapon of somewhat behind it.

Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

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