Userdefined vertexdata for realtimeshaders?

Date : Fri, 04 Aug 2006 13:32:59 +0200
To : xsi(at)Softimage.COM
From : André Adam <a_adam(at)49games.de>
Subject : Userdefined vertexdata for realtimeshaders?
Heya, perhaps someone who has done this before can help out one of our programmers?

Thanks in advance for any hint, cheers!

   -André

-----

Hi!

I'm in the middle of writing a realtimeshader (OpenGL (2.0)) and currently lighting via normalmaps is implemented.

For correct interpretation of the normals in the normalmap you need some extrainformation (the tangent to compute the tangentspacetransformation) per vertex.

Currently we compute the tangent on the fly before passing the data to OpenGL because the "XSI_RTS_TriangulatedGeometry" (see below) doesn't leave space for userdata.
This has two drawbacks:
1. Every frame we compute data which doesn't change if the geometry doesn't change.
2. The result contains artefacts because we can't "smooth" the data since we'd need to find all adjacent triangles of a vertex to do so. (And this is to expensive to do on trianglelists!)



The solution could be some preprocessing of the geometry in XSI and then let XSI pass this preprocessed data along with the positions, normals, colors and texcoords to the realtimeshader.
Unfortunately the only way we saw was a normalmapping-implementation which stores the extradata needed in the vertexcolor values. Unfortunately we need the vertexcolors for other purposes - like coloring the object... :)


Is it somehow possible to pass userdefined vertexdata to a realtimeshader?


Thanks in advance!

Bjoern Gdanietz

-----------------

(From XSISDK 5.11)

typedef struct tagXSI_RTS_TriangulatedGeometry
{
// Triangle lists information
ULONG m_Type;
ULONG m_lNbTriangleLists; //! Number of triangle lists
XSI_RTS_TriangleList *m_pTriangleLists; //! Triangle lists
ULONG m_NbVertices; //! Total number of vertices
// Pointer streams
XSI_RTS_Vector3d **m_pPositionDPtrArray; //! Array of pointers to the positions (DOUBLE)
XSI_RTS_Vector3 **m_pPositionPtrArray; //! Array of pointers to the positions
XSI_RTS_Vector3 **m_pNormalPtrArray; //! Array of pointers to the normals
XSI_RTS_ColorRGBA **m_pColorPtrArray; //! Array of pointers to the colors XSI_RTS_Vector2 **m_pTexCoordPtrArray; //! Array of pointers to the texture
// Vertex attribute arrays streams
ULONG m_NbUniqueVertices; //! Total number of unique vertices
XSI_RTS_Vector3 *m_pPositionArray; //! Array of positions
XSI_RTS_Vector3 *m_pNormalArray; //! Array of normals (interleaved by streams)
XSI_RTS_ColorRGBA *m_pColorArray; //! Array of colors (interleaved by streams)


 XSI_RTS_Vector2 *m_pTexCoordArray; //! Array of texture coordinates
 ULONG         *m_pIndices;   //! Array of global indices

// Number of normals, colors and texture coordinates
ULONG m_lNbNormalStreams; //! Number of normal streams
ULONG m_lNbColorStreams; //! Number of color streams
ULONG m_lNbTexCoordStreams; //! Number of texture coordinates streams


} XSI_RTS_TriangulatedGeometry;






--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.