Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 677 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Force 2 sided rendering [Re: Stratego] #426061
07/16/13 01:05
07/16/13 01:05
Joined: Jul 2013
Posts: 22
S
Stratego Offline OP
Newbie
Stratego  Offline OP
Newbie
S

Joined: Jul 2013
Posts: 22
Okay so this is my result:



I threw this tree together today. It's not quite done, but I decided to see if I could get it running real-time. So I dusted off good old Gamestudio.

If anyone else has any suggestions for vegetation, let me know.

Also, this seems like something common, since outdoor scenes will likely require it. Maybe there should a place where common questions and answers are listed?

Re: Force 2 sided rendering [Re: Stratego] #426062
07/16/13 01:12
07/16/13 01:12

M
Malice
Unregistered
Malice
Unregistered
M



Is this any different then what you have?

Code:
effect = "technique { pass { CullMode = None; AlphaTestEnable = True; ZWriteEnable = true;} }";


Last edited by Malice; 07/16/13 01:13.
Re: Force 2 sided rendering [Re: ] #426063
07/16/13 01:14
07/16/13 01:14
Joined: Jul 2013
Posts: 22
S
Stratego Offline OP
Newbie
Stratego  Offline OP
Newbie
S

Joined: Jul 2013
Posts: 22
Yes, actually. I put it in a diffuse shader. I'll give that a try.

Re: Force 2 sided rendering [Re: Stratego] #426064
07/16/13 01:27
07/16/13 01:27
Joined: Jul 2013
Posts: 22
S
Stratego Offline OP
Newbie
Stratego  Offline OP
Newbie
S

Joined: Jul 2013
Posts: 22
Okay, so I tried what Malice suggested:

effect = "technique { pass { CullMode = None; AlphaTestEnable = True; ZWriteEnable = true;} }";

Here's the result:



This results has a much more prevalent blue outline around the transparent areas then when I used the OVERLAY flag and putting CullMode = None; into the diffuse shader from the workshops.

I think this way looks worse. Am I just getting lucky with OVERLAY, because I'm not sure it is supposed to help in this case, but I was fiddling around?

Edit: actually after looking at them, I'm not sure which I like more.

Last edited by Stratego; 07/16/13 01:46.
Re: Force 2 sided rendering [Re: Stratego] #426065
07/16/13 02:00
07/16/13 02:00
Joined: Jul 2013
Posts: 22
S
Stratego Offline OP
Newbie
Stratego  Offline OP
Newbie
S

Joined: Jul 2013
Posts: 22
In case anyone cares, I adjusted the lighting in the diffuse shader to better match the default lighting.

Result:



I think this is the better of the two, the difference is (and experts correct me if I'm wrong) the OVERLAY flag cuts off transparency completely while the other method allows gradients in transparency, so the outline effect is more prevalent. For my situation this looks better, but mileage may vary.

Edit: One last thing of note. The blue outline I was referring to earlier that seems to outline transparencies seems directly related to the background color (sky_color) even though I have a sky cube set up. Setting sky_color to a more desaturated color helped an incredible amount.

Last edited by Stratego; 07/16/13 15:08.
Re: Force 2 sided rendering [Re: Stratego] #426102
07/16/13 16:33
07/16/13 16:33

M
Malice
Unregistered
Malice
Unregistered
M



Sky_color should be set to vector(0,0,0) if you use a sky_cube. You pick up many fps if you do this but I have no idea what will happen to the outline.

Re: Force 2 sided rendering [Re: ] #426107
07/16/13 16:48
07/16/13 16:48
Joined: Jul 2013
Posts: 22
S
Stratego Offline OP
Newbie
Stratego  Offline OP
Newbie
S

Joined: Jul 2013
Posts: 22
Thanks Malice! It's been so long I've forgotten just about everything. It took me a half hour just to find sky_color!

Looks like if sky_color is set to 0,0,0 then the outline picks up the colors of the sky cube, so in some cases (like if you have a crazy sky) it might be beneficial to still use sky color for a dimmer outline if the fps hit isn't that bad.

Last edited by Stratego; 07/16/13 16:51.
Re: Force 2 sided rendering [Re: Stratego] #426141
07/17/13 06:35
07/17/13 06:35
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
hi ,

I use the following and fine with overlay too:

Code:
technique animTree
{
	pass 
		{
			ZWriteEnable 		= True;		
			AlphaTestEnable 	= True;
		   AlphaBlendEnable 	= False;		   
			VertexShader = compile vs_2_0 animTree_VS(); 
		}
}



Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Force 2 sided rendering [Re: sivan] #426184
07/17/13 15:27
07/17/13 15:27
Joined: Jul 2013
Posts: 22
S
Stratego Offline OP
Newbie
Stratego  Offline OP
Newbie
S

Joined: Jul 2013
Posts: 22
So I've settled on this for now. In hindsight it seems pretty simple, but maybe it will be helpful for someone new who digs up this thread in the future.

I set up a material for the tree, and added the line:

effect = "technique { pass { AlphaTestEnable = True; ZWriteEnable = True; AlphaBlendEnable = False; CullMode = None;} }";

Thanks to everyone for all their help! I think this does what I wanted originally. I won't reply to this thread anymore as I have started a new one in "shaders" for more complicated tree techniques.

Last edited by Stratego; 07/17/13 16:25.
Re: Force 2 sided rendering [Re: Stratego] #426194
07/17/13 17:35
07/17/13 17:35
Joined: Jul 2013
Posts: 22
S
Stratego Offline OP
Newbie
Stratego  Offline OP
Newbie
S

Joined: Jul 2013
Posts: 22
Okay, so I lied. I have one more thing to add.

After some testing I have concluded that it makes more sense to use double the polygons for the leaves (undersides' normals are flipped). This way leaves are lit correctly -the undersides of leaves aren't lit the same as the top sides. This leads to much better tree lighting in my opinion. Here is an example of the same tree but with both sides of leaf planes modeled out (ambient probably needs to be adjusted, but you get the idea):



Also, after trying out the animTree.fx I've come to the conclusion that trunk and leaves should should be separate models because the trunk looks really funky when the vertices are waving around, but the leaves look great.

Page 2 of 3 1 2 3

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