Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, TedMar, dr_panther, Ayumi), 1,072 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
setting grass normals for recieving more uniform lighting #433029
11/21/13 15:26
11/21/13 15:26
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline OP
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
a little tip: setting vertex normals to point upwards makes lighting of grass models more uniform, and look much better when the camera moves around (I added this quick feature to MapBuilder a few minutes ago)



Code:
void Grass_SetNormals(ENTITY* ent)
{	
	int i;
	for (i=1; i<=(var)(ent_status(ent, 0)); i++)
		{	
			CONTACT* c = ent_getvertex(ent, NULL, i);   	// vertex number begins with 1 !			
			
			c.v.nx = (float)0; 		
			c.v.nz = (float)0; 				
			c.v.ny = (float)1; 				// upwards - uniform lighting

			
			ent_setvertex(ent, c, i);
		}
}



another tip: for tree leaves I use an modified central normalization. more exactly, normals got by lerping 2 values: the vector pointing out from entity middle to the actual vertex, and its original normal vector.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: setting grass normals for recieving more uniform lighting [Re: sivan] #433030
11/21/13 15:27
11/21/13 15:27
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline
Expert
oliver2s  Offline
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Thank you laugh

Re: setting grass normals for recieving more uniform lighting [Re: oliver2s] #433034
11/21/13 17:25
11/21/13 17:25
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Thanks for the tip, the tree shading looks nice, too!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: setting grass normals for recieving more uniform lighting [Re: sivan] #433686
12/04/13 13:54
12/04/13 13:54
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
Quote:
another tip: for tree leaves I use an modified central normalization. more exactly, normals got by lerping 2 values: the vector pointing out from entity middle to the actual vertex, and its original normal vector.


I'm very bad with graphical stuff tongue but your trees look awesome!
Could you explain more in-depth what the above means? laugh


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: setting grass normals for recieving more uniform lighting [Re: EpsiloN] #433689
12/04/13 14:07
12/04/13 14:07
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline OP
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I will share that script here too, but is already available in MapBuilder, in obstacleplace.c
now I use a bit refined grass normal setting function, if I have time I will put here...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: setting grass normals for recieving more uniform lighting [Re: sivan] #433748
12/06/13 07:13
12/06/13 07:13
Joined: Apr 2012
Posts: 62
wrekWIRED Offline
Junior Member
wrekWIRED  Offline
Junior Member

Joined: Apr 2012
Posts: 62
MB just keeps getting better and better. cool work.


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

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