Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Double-sided Shaders / 2-sided normal #155581
09/20/07 07:25
09/20/07 07:25
Joined: Aug 2007
Posts: 17
J
jedilq Offline OP
Newbie
jedilq  Offline OP
Newbie
J

Joined: Aug 2007
Posts: 17
Does anyone know how to create a flat polygon (2 sided) that has a skin that can be visible from both sides? In Maya it's called a double-sided shader or 2-sided normal.

Any ideas?

Thanks!

Re: Double-sided Shaders / 2-sided normal [Re: jedilq] #155582
09/20/07 08:35
09/20/07 08:35
Joined: Jul 2004
Posts: 8
H
hourousha Offline
Newbie
hourousha  Offline
Newbie
H

Joined: Jul 2004
Posts: 8
first:Change the cullmode
technique Two_Side
{
pass p0
{
......
CullMode = NONE;
......
}
}
second,In the vertexshader,calculate the Normal :
VERTEX_OUTPUT Two_Side_VS(const VERTEX_INPUT Input)
{
.......
float4 WorldPos = mul(float4(Input.position.xyz,1.0),matWorld);
float3 ViewVec.xyz = vecViewPos - WorldPos;
float3 Normal = mul(float4(Input.normal.xyz,1.0),transpose(matWorldInv));
Normal = mul(ViewVec.xyz,Normal.xyz)>0?Normal,-Normal;//if CCW face is visible,flip Normal
.......
}

Re: Double-sided Shaders / 2-sided normal [Re: hourousha] #155583
09/21/07 02:33
09/21/07 02:33
Joined: Aug 2007
Posts: 17
J
jedilq Offline OP
Newbie
jedilq  Offline OP
Newbie
J

Joined: Aug 2007
Posts: 17
Oh Wow!

I was actually thinking of being able to do it using the WED or MED, because I have designers who freak out at the sight of code and want a more visual way of doing it.

Any ideas?

Thanks!

Re: Double-sided Shaders / 2-sided normal [Re: jedilq] #155584
09/21/07 02:45
09/21/07 02:45
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
just in your code put that in a material, and the material will be accesible thru wed.

Re: Double-sided Shaders / 2-sided normal [Re: jedilq] #155585
09/21/07 03:48
09/21/07 03:48
Joined: Jul 2004
Posts: 8
H
hourousha Offline
Newbie
hourousha  Offline
Newbie
H

Joined: Jul 2004
Posts: 8
you can write Material Effects to .fx files,such as phong.fx,two_side.fx and so on.then,define the materials in your script,
material mat_phong
{
effect = "phong.fx";
}
material mat_2side
{
effect = "two_side.fx";
}
after doing this,you can attach materials to the entites in WED.

You can also attach the .fx to modle's subsets in MED:Edit->Manage skins->skin setting->Effect Setup->load FX.
It's useful for modles those contain multiple subset,It can attach different fx to different subset of a modle.but you can't use A6 material Event and extra texture and so on...
pardon me for my poor English

Re: Double-sided Shaders / 2-sided normal [Re: jedilq] #155586
09/21/07 15:45
09/21/07 15:45
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
Quote:


I was actually thinking of being able to do it using the WED or MED, because I have designers who freak out at the sight of code and want a more visual way of doing it.




People like that shouldnt work on computer games then.


Sphere Engine--the premier A6 graphics plugin.
Re: Double-sided Shaders / 2-sided normal [Re: Matt_Aufderheide] #155587
09/21/07 18:10
09/21/07 18:10
Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
frazzle Offline
Expert
frazzle  Offline
Expert

Joined: Mar 2006
Posts: 2,758
Antwerp,Belgium
Quote:

Quote:


I was actually thinking of being able to do it using the WED or MED, because I have designers who freak out at the sight of code and want a more visual way of doing it.




People like that shouldnt work on computer games then.




Indeed, a decent running game needs a decent programmed code as well.
I guess there will be always people that don't like to script but relating this to the game itself, then you can suspect in theory that the game will not run Btw, sorry for being off-topic/morbius related.

Cheers

Frazzle


Antec® Case
Intel® X58 Chipset
Intel® i7 975 Quad Core
8 GB RAM DDR3
SSD OCZ®-VERTEX2 3.5 x4 ; HD 600 GB
NVIDIA® GeForce GTX 295 Memory 1795GB
Re: Double-sided Shaders / 2-sided normal [Re: frazzle] #155588
09/24/07 08:46
09/24/07 08:46
Joined: Sep 2007
Posts: 658
germany
Tiles Offline
User
Tiles  Offline
User

Joined: Sep 2007
Posts: 658
germany
Isn't the idea behind 3D Gamestudio to make things easier? For me such an FX file sounds like standard stuff that is used all the time. So shouldn'`t be such stuff in the templates somewhere?


trueSpace 7.6, A7 commercial
Free gamegraphics, freewaregames http://www.reinerstilesets.de
Die Community rund um Spiele-Toolkits http://www.clickzone.de
Re: Double-sided Shaders / 2-sided normal [Re: Tiles] #155589
09/29/07 11:47
09/29/07 11:47
Joined: Sep 2007
Posts: 658
germany
Tiles Offline
User
Tiles  Offline
User

Joined: Sep 2007
Posts: 658
germany
Being a completely newbie, and just have read the first chapters of the Lite C tutorials yet, I am still stuck with this problem. I have written a *.fx file that includes the code from above to set the cullmode off.

action Noculling
{
while(1)
{
CullMode = NONE;
wait(1);
}
}

Then I have included it into my main script. The action appears. And i can access it. But when trying to run it, it just gives me errors. Unknown Keyword CullMode. Could somebody be so kind to help me out? What have i misunderstood here?


trueSpace 7.6, A7 commercial
Free gamegraphics, freewaregames http://www.reinerstilesets.de
Die Community rund um Spiele-Toolkits http://www.clickzone.de
Re: Double-sided Shaders / 2-sided normal [Re: Tiles] #155590
09/30/07 04:57
09/30/07 04:57
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
In WDL file:
Code:

material mat_twoside
{
effect = "twoside.fx";
}



In "twoside.fx" file:
Code:

technique twoside
{
pass p1
{
cullMode = none;
}
}



It's 1am, so hopefully I didn't have any typos...


xXxGuitar511
- Programmer
Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

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