How do I render a mesh using a custom set of shaders?

Hi there,

I am looking for some tips on how I would go about rendering a mesh that has the following rendering process:

  • Dummy vertex shader (Does nothing)
  • Hull and Domain shaders - Generates a series of isolines from a buffer provided by me
  • Geometry shader - Takes the isolines and generates geometry
  • Pixel Shader - renders the geometry.

So essentially I dont provide a vertex buffer or index buffer or an input layout, all vertex data is generated on the GPU based on some data I provide. This seems to go against the Vertex Factory approach (Which expects FVertexFactoryInput to have some data - Unless i can set that to blank), also DrawMesh does not allow me to specify zero primitives (I only need to set the number of vertices).

Is it possible to render the mesh without using a Vertex Factory, but defining the shaders I require, while still remaining with the Deferred rendering pipeline? For now I am not too worried about being able to apply a Material to this mesh, in the end I will only need a base colour. I will provide the normals and such.

If it can be avoided I don’t want to have to modify the BasePass shaders or the MaterialTemplate shaders. As the plan is to distribute this as a plugin eventually, I want to keep my modifications of other shaders to a minimum.

Will this actually be possible from a plugin? Or should I just modify the engine to do this.

Please ask any questions, as Im not sure if I have explained well enough what I am trying to achieve.

I have managed to solve this by not using a vertex factory and setting the shaders and such myself.

Could you share some code that demonstrates a basic pipeline of using custom shaders? I haven’t found any official documentation that is good enough to get me started.

Yes, could you share knowledge by sample from vertex → hull → tessellator → domain → geom → pixel shader. ?

I found this:

I discovered that pixel and vertex shaders can be done via the material editor, after a looooong long time of research on all documenation and forums I could find. Seems like doing it by hand is not always possible… not as easy as creating a simple hsls shader for pixel and vertex shaders and asigning them to a material, like you do in Unity in two clicks. You can even see the HSLS code generated in the material editor (windows → HLSL code window)…

In fact, everybody talks about pixel shaders in the material editor, but using “World Position Offset” plug on it lets you modify the vertices too… using the UV coordinates. Lucky the one who can figure out a way to pass per-vertex data to it!