Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (Petra, AndrewAMD, VoroneTZ, Quad, 2 invisible), 833 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Flat shading for models!!! #223597
08/25/08 11:03
08/25/08 11:03
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
Hi all,
being a game artist and not a shader programmer, I just want to make my models look good in the game, and often that requires them to be flat(solid) shaded. By default gamestudio blends the normal values to create a smooth shaded model, but for a vehicle or building, obviously you want to make it look like it's made of metal or cement, not jelly. The only way around this I have found is to seperate the desired face (so there are no normals around it to blend), but for a cube, this triples the amount of vertices besides being very time consuming. Do any of you have a shader/material(whatever!) that I can apply that will give me these hard edges?


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).
Re: Flat shading for models!!! [Re: Impaler] #223627
08/25/08 13:55
08/25/08 13:55
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
As far as I know, this isn´t possible but if anyone knows it better, please post how to do it smile.

Re: Flat shading for models!!! [Re: Slin] #223631
08/25/08 14:08
08/25/08 14:08
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
you can't control this for individual edges with a material. you can only enable or disable gouraud shading for the whole model.

if you need control over single edges then splitting vertices is the only way. the increased vertex count doesn't matter at all. for directx mesh buffers the splitting has to be done anyway internally. there is no other way of achieving hard edges with directx (and also opengl).

but of course this can be an annoying workflow in some software. ideally the mdl exporter should care for this and convert smoothing information to correctly split up geometry.

blender handles this very well. if you use the edge split modifier you can define the smoothing like you want and everything will end up in gamestudio correctly.

Re: Flat shading for models!!! [Re: ventilator] #223652
08/25/08 17:48
08/25/08 17:48
Joined: Mar 2007
Posts: 75
Hamburg, Ger
Altimeter Offline
Junior Member
Altimeter  Offline
Junior Member

Joined: Mar 2007
Posts: 75
Hamburg, Ger
Ventilator is right. Once I had the same problem. I applied a flat shader, but it did not solve the problem. You really have to accept some double vertices to split the edges.

Re: Flat shading for models!!! [Re: Altimeter] #223659
08/25/08 18:26
08/25/08 18:26
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
you can apply a shader to only certain parts of a model, just use a seperate skin and apply the fx file to the skin in med. That way only certain parts would have gourad shading, but i'm not sure it would make the hard edges you want, it might even look a bit odd when rendered...


- aka Manslayer101
Re: Flat shading for models!!! [Re: mpdeveloper_B] #223706
08/26/08 06:05
08/26/08 06:05
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
Quote:

you can only enable or disable gouraud shading for the whole model.

Ventilator, how do you switch gouraud shading on or off for the whole model then? That's really all I'm interested in for now - I do use blender for all my models and if I need only parts of it smooth shaded I can seperate those manually, but it is much more vertex count intensive to separate every face of a complete model. Just knowing how to turn off gouraud shading for the whole model would be great.


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).
Re: Flat shading for models!!! [Re: Impaler] #223778
08/26/08 17:07
08/26/08 17:07
Joined: Apr 2008
Posts: 2,488
ratchet Offline
Expert
ratchet  Offline
Expert

Joined: Apr 2008
Posts: 2,488
Under Blendre it's pretty simple :
-Select your object
- Enter in edit mode
-Just select the faces you want to smooth
- then having the mouse anywhere in the 3D view :
press "Space"
It will onpen the menu , then choose the submenus :
- Edit -> Faces -> Set smooth
or if you want some faces (or all) to be not smooth but solid:
Choose
- Edit -> Faces -> Set Solid


If you want a model to mix smooth and Hard edges in game,
the way to go is like already said here:
Apply one texture on the faces to be smooth and another
on the face to keep solid, then apply two different shaders
to the two textures.



Last edited by ratchet; 08/26/08 17:08.
Re: Flat shading for models!!! [Re: ratchet] #223803
08/26/08 18:58
08/26/08 18:58
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
you simply have to set the "ShadeMode" state to "Flat" instead of "Gouraud" in a fixed function material.



in blender it's much better to use "set smooth" on everything and then use the edge split modifier to define smoothing.

"set smooth" and "set solid" don't offer good enough control over smoothing and many exporters won't handle it correctly.

Re: Flat shading for models!!! [Re: ventilator] #223807
08/26/08 19:24
08/26/08 19:24
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline
Expert
mpdeveloper_B  Offline
Expert

Joined: Feb 2006
Posts: 2,185
@ventilator: thanks, i couldn't remember it myself...

@Impaler: so basically, put this in a fx file:

Code:
technique flatshade
{
	pass p0
	{
		shademode = Flat;
	}
}


then as before mentioned apply that fx file to a skin that is applied to the normals that you want to be flat shaded, or to the main skin of the model itself.


- aka Manslayer101
Re: Flat shading for models!!! [Re: mpdeveloper_B] #223891
08/27/08 03:52
08/27/08 03:52
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
Thanks, mpdeveloper_B,
that's exactly what I was looking for smile


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).

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