Page 1 of 1

Tiltbrush - Rendering in Octane for Unity?

PostPosted: Sun Mar 01, 2020 4:32 pm
by SamuelAB
Hi,

I've been using Tiltbrush art with the "TiltBRush Toolkit" for Unity:
https://github.com/googlevr/tilt-brush-toolkit

This is the only way to get the proper vertex color information from Tiltbrush, and some effects as well. I don't use the effects, but I do need the color vertex information. If you look at the vertex colors without this plugin, the colors are there, but all messed up.

The proper shader to use is called "Brush/Special/Unlit". It shows up everything properly i Unity. However, Octane in Unity cannot read this shader. Here is the content of this Unity shader:

Code: Select all
Shader "Brush/Special/Unlit" {

Properties {
    _MainTex ("Texture", 2D) = "white" {}
    _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5

}

SubShader {
    Pass {
        Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
        Lighting Off
        Cull Off

        CGPROGRAM

        #pragma vertex vert
        #pragma fragment frag
        #pragma multi_compile __ TBT_LINEAR_TARGET
        #pragma multi_compile_fog
        #include "../../../Shaders/Include/Brush.cginc"
        #include "UnityCG.cginc"

        sampler2D _MainTex;
        float _Cutoff;

        struct appdata_t {
            float4 vertex : POSITION;
            float2 texcoord : TEXCOORD0;
            float4 color : COLOR;
        };

        struct v2f {
            float4 vertex : POSITION;
            float2 texcoord : TEXCOORD0;
            float4 color : COLOR;
            UNITY_FOG_COORDS(1)
        };

        v2f vert (appdata_t v)
        {

            v2f o;

            o.vertex = UnityObjectToClipPos(v.vertex);
            o.texcoord = v.texcoord;
            o.color = TbVertToNative(v.color);
            UNITY_TRANSFER_FOG(o, o.vertex);
            return o;
        }

        fixed4 frag (v2f i) : COLOR
        {
            fixed4 c;
            UNITY_APPLY_FOG(i.fogCoord, i.color);
            c = tex2D(_MainTex, i.texcoord) * i.color;
            if (c.a < _Cutoff) {
                discard;
            }
            c.a = 1;
            return c;
        }

        ENDCG
    }
}

Fallback "Unlit/Diffuse"

}


Would it be possible to reproduce the results of this shader for Octane in Unity? Or even Octane for 3ds Max?

Please note that this shader is not meant to receive light, but I want to apply light to it to bake the shadows and have very high quality Octane lighting being received by the art.

Thank you!