Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411425 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 19, 2024, 08:50:02 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Planes Do Not Render As Visable
Pages: [1]
Print
Author Topic: Planes Do Not Render As Visable  (Read 833 times)
Henry_Oswald
Level 1
*



View Profile WWW
« on: April 21, 2014, 06:41:16 AM »

I was having a bit of an issue getting these vines to work, and I wanted to know if anyone knew of a solution. What I've been trying to make is a nice wall climbing plant. I use Blender's Ivy Generator to make the mesh (In blender this possesses both vines and leafs), but then when I export it to Unity I only get vines. Even when I apply a material to the leaf sections, they still are only visible from certain angles. Can anyone tell me what's going wrong?

Leaves are visible


Leaves are not visible


Leaf texture
Logged

"Do you think love can bloom even on the battlefield?"
- Otacon
Quill Devlog: http://forums.tigsource.com/index.php?topic=38129.0
Home Website: http://psychospectacle.weebly.com
Watch us on IndieDB: http://www.indiedb.com/games/quill
Follow us on Twitter: https://twitter.com/PsychoSpecs
Christian Knudsen
Level 10
*****



View Profile WWW
« Reply #1 on: April 21, 2014, 06:53:19 AM »

I'm not really familiar with either program, but I'm guessing Unity is only rendering the quads as single-sided?
Logged

Laserbrain Studios
Currently working on Hidden Asset (TIGSource DevLog)
Henry_Oswald
Level 1
*



View Profile WWW
« Reply #2 on: April 21, 2014, 01:36:52 PM »

Whoops. Yep, that was it. Thank you.
Do you, however, know of a way I can make them appear visible from both sides? I'm thinking about stacking opposite normal planes on top of these, however, that would be really in-optimized and really tedious.
Logged

"Do you think love can bloom even on the battlefield?"
- Otacon
Quill Devlog: http://forums.tigsource.com/index.php?topic=38129.0
Home Website: http://psychospectacle.weebly.com
Watch us on IndieDB: http://www.indiedb.com/games/quill
Follow us on Twitter: https://twitter.com/PsychoSpecs
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3 on: April 22, 2014, 03:31:29 AM »

You could make a copy of the shader you are currently using, and modify it by simply adding the line:

Code:
Cull Off

( Here's a document on that: https://docs.unity3d.com/Documentation/Components/SL-CullAndDepth.html )

So, you have to download built-in shader sources according to your unity version:
https://unity3d.com/unity/download/archive

Then, in that package find the shader you use for your leaves, copy it's contents, make a new shader and paste the contents there, and simply modify it with what I mentioned above.

This is the best option, I think.


So, if you are using Transparent/Diffuse shader, you have to find the shader Alpha-Diffuse.shader in the downloaded package, and turn this:

Code:
Shader "Transparent/Diffuse" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}

SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200

CGPROGRAM
#pragma surface surf Lambert alpha

sampler2D _MainTex;
fixed4 _Color;

struct Input {
float2 uv_MainTex;
};

void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}

Fallback "Transparent/VertexLit"
}

Into this:

Code:
Shader "Transparent/Diffuse" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}

SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
Cull Off

CGPROGRAM
#pragma surface surf Lambert alpha

sampler2D _MainTex;
fixed4 _Color;

struct Input {
float2 uv_MainTex;
};

void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}

Fallback "Transparent/VertexLit"
}

Should do it.
« Last Edit: April 22, 2014, 03:37:53 AM by kamac » Logged

Henry_Oswald
Level 1
*



View Profile WWW
« Reply #4 on: April 23, 2014, 08:42:27 PM »

Yep! Thanks a ton. I've been going deeper into shader writing since I first opened this thread, and it's all been pretty great to mess around with. These are the render's that I've tried so far.



My favorite one is the third, but it feels very flat. Do you know how I could get the soft occlusion effects that the second one has and add it onto the third one? Here's my code so far. This renders the third image.

Code:
Shader "Custom/BasicTest" {
Properties{
_Color("Base Color", Color) = (0.5,0.5,0.5,0.5)
_MainTex("Main Texture", 2D) = "white"{}
_AlphaCut("Alpha Cutoff", Range(0,1)) = 0.5
}
Subshader{
Material{
Diffuse[_Color]
Ambient[_Color]
}
Lighting On
Cull Off
SeparateSpecular On
Pass{
AlphaTest Greater [_AlphaCut]
SetTexture [_MainTex]{
constantColor[_Color]
Combine texture * primary DOUBLE, texture * constant
}
}
Pass{
ZWrite off
ZTest Less
AlphaTest LEqual [_AlphaCut]
Blend SrcAlpha OneMinusSrcAlpha
SetTexture[_MainTex]{
combine texture * primary, texture * constant
}
}
}
}

Thanks for all the help!
Logged

"Do you think love can bloom even on the battlefield?"
- Otacon
Quill Devlog: http://forums.tigsource.com/index.php?topic=38129.0
Home Website: http://psychospectacle.weebly.com
Watch us on IndieDB: http://www.indiedb.com/games/quill
Follow us on Twitter: https://twitter.com/PsychoSpecs
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic