#As far as I know the semantics are

1 messages · Page 1 of 1 (latest)

hybrid bison
#
sampler2D _MainTex;

struct appdata_voxel
{
    // x: 4 bits 0-3
    // y: 4 bits 4-7
    // z: 4 bits 8-11
    // normalIndex: 3 bits 12-14
    // uvIndex: 8 bits 15-22
    uint data : BLENDINDICES0;
};

struct v2f
{
    float4 position : SV_POSITION;
    float2 uv : TEXCOORD0;
};

v2f vert (appdata_voxel v)
{
    // Extract from passed data
    uint x = v.data & 0xF;
    uint y = (v.data >> 4) & 0xF;
    uint z = (v.data >> 8) & 0xF;
    uint uvIndex = (v.data >> 15) & 0xFF;

    // Construct proper
    float4 position = float4((float)x, (float)y, (float)z, 1.0f);
    float2 uv = float2(((float)uvIndex - 0.5f) / 255.0f, 0.5f);

    // Construct output
    v2f o;
    o.position = UnityObjectToClipPos(position);
    o.uv = TRANSFORM_TEX(uv, _MainTex);
    return o;
}

fixed4 frag (v2f i) : SV_Target
{
    fixed4 col = tex2D(_MainTex, i.uv);
    return col;
}

This is the unlit shader I'm using. Do you see anything incorrect? Issue is its not rendering anything.

queen crest
#

There's nothing that pops out to me as incorrect, but it's difficult to tell just from reading this. I'd say to help with debugging, you could temporarily pass in the vertex position normally alongside the packed uint and use it just to get the mesh on screen where it should be, and then you can output some of the values you're unpacking as the frag color, to validate they look normal.

#

Because that seems like the most likely cause. Either an issue with the packing or unpacking, or both.

#

But outputting the values will also let you confirm whether you're getting any data at all or just zeros.

#

You can also use a debugging tool like RenderDoc to inspect the raw mesh attributes being passed to the graphics API.