Unity-Technologies / Unity-Technologies/NativeRenderingPlugin

Question about vertex buffer layout

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
943
Forks
186
PR merge metrics
No merged PRs in 30d

Description

I was wondering if the vertex buffer layout is always the same from Unity 2018.4 with DirectX 11 ?

You are using this structure :

struct MeshVertex
{
	float pos[3];
	float normal[3];
	float color[4];
	float uv[2];
};

But let say I just want to use pos and color attributes from my shaders, could I use directly the structure below to fill my ID3D11Buffer ?

struct MeshVertex
{
	float pos[3];
	float color[4];
};

Then before calling the native plugin I could just initialize the mesh like that

m_meshFilter = GetComponent<MeshFilter>();
m_meshFilter.mesh = new Mesh();
m_meshFilter.mesh.indexFormat = IndexFormat.UInt32;
m_meshFilter.mesh.vertices = new Vector3[100000];
m_meshFilter.mesh.colors = new Color[100000];

Also, other question : Do I really need to call MarkDynamic() on the mesh instance if I only set the vertex buffer once during the game ?

Thank you.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no file, test, or entry point. Review the Unity 2018.4 DirectX 11 mesh and native-plugin usage described here, focusing on vertex attributes and MarkDynamic(); done means documenting whether the reduced layout is supported and whether MarkDynamic() is needed for a one-time upload.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp, unity
Domain
computer-graphics, game-dev
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.