Jump to content
  • Advertisement
Sign in to follow this  
porters

Creating a custom vertex for use in Vertex Shader

This topic is 2460 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

Basically i'm trying to create a custom vertex and use it in my vertex shader. The vertex is simply a standard position colored vertex, but i want to add an integer value as well. I cant seem to figure out what vertexformat and vertex semantic to use for this integer value. I've tried using the pointsize and blendindices formats/semantics, but the shader doesnt seem to recognize any value a set for scale.

How can i use an integer value in my custom vertex?

Heres an example of my vertex structure as defined in my program (VB.Net):


<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _
Public Structure PositionColoredScale
Public Position As Vector3
Public Color As Integer
Public Scale As Integer
Public Shared ReadOnly Format As VertexFormat = VertexFormat.Position Or VertexFormat.Diffuse Or VertexFormat.None
Public Shared ReadOnly Property SizeInBytes() As Integer
Get
Return System.Runtime.InteropServices.Marshal.SizeOf(GetType(PositionColoredScale))
End Get
End Property
End Structure



Here's the structure in my shader:


struct VSInputVcScl
{
float4 Position : POSITION;
float4 Color : COLOR;
uint Scale : BLENDINDICES0;
};


Thanks guys.

Share this post


Link to post
Share on other sites
Advertisement
I could do that, but i dont see how that solves my problem. I'm after the correct semantic/vertex format to use for passing an arbitary integer (or a float) value to the shader. I want the GPU to ignore this value, it will only be used by me in some calculations.

Share this post


Link to post
Share on other sites
I think there may be something wrong at other places.

Additionally,I find D3DFVF_SPECULAR is DWORD, but i haven' never used.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!