Wireframe material

(6 posts) (3 voices)
  • Started 2 years ago by fredericgoncalves
  • Latest reply from fredericgoncalves

Tags:

No tags yet.

  1. fredericgoncalves

    member
    Joined: Dec '14
    Posts: 12

    Hello

    I am currently creating a mesh using a vkGeometry and vkPrimitive. It works just fine.
    I want the user to see the triangles of the created mesh in order to select one of them for futur calculation.

    I know that the render options can force wireframe but it affects all the scene. Moreover, Virtools allowed material to display the attached object in wireframe. I haven't seen an equivalent in 3DVIA Studio.

    Is there a way in 3DVIA Studio to do this ?
    Thanks in advance.

    Posted 2 years ago #
  2. flamenco

    3DVIA Studio Guru
    Joined: Sep '09
    Posts: 188

    Hi,
    One solution :
    - Create a new material,
    - Drag & drop debugWireframe.fx shader inside Viewport
    (C:\Program Files (x86)\3DVIA\3DVIA Studio Pro\data\Shaders\DebugWireframe.fx)
    - Assign debugWireframe.fx shader to you new material
    - Assign your new material to any object you want

    If the rendering is not exactly what you want (solid rendering + wireframe on top of it -> wireframe is not transparent), you could look and modify shader code.

    Hope it helps,
    Arnaud.

    Posted 2 years ago #
  3. fredericgoncalves

    member
    Joined: Dec '14
    Posts: 12

    Hello,

    Thanks for the answer. It was helpful.

    Just for information :
    I tested the shader you mentioned, it seems to be the one behind the render manager option (it causes the same effect).

    I have to learn shader programming to modify the shader.

    Posted 2 years ago #
  4. flamenco

    3DVIA Studio Guru
    Joined: Sep '09
    Posts: 188

    ok cool. Yes indeed, this is probably the shader used to override the whole scene for fullscene wireframe rendering.
    About modification, might be able to help if you describe what you want to change,
    Cheers,
    Arnaud.

    Posted 2 years ago #
  5. iainB85

    Interplanetary Delivery Boy
    Joined: Jun '08
    Posts: 515

    Actually it's very easy to modify this shader to be full wireframe as opposed to wireframe on solid... I figured it out a while ago for a project with a few google searches.

    Open up the DebugWireframe shader in Studio, and scroll down near the bottom and look for

    pass P0
        {
    		ColorWriteEnable = 0x0;
    		FillMode = SOLID;
    		ZWriteEnable = true;
    
    		VertexShader = compile vs_2_0 VS();
    		PixelShader = compile ps_2_0 PS();
    	}

    and simply change the "FillMode = SOLID;" to "FillMode = WIREFRAME;" and presto, you have full wireframe shader!

    Posted 2 years ago #
  6. fredericgoncalves

    member
    Joined: Dec '14
    Posts: 12

    Thanks for the answer.

    I create the mesh passing the material with the wireframe shader within.
    I want the user to be able to choose the color of the exposed faces of the mesh and also the color of the wire dispalyed. I want this because, depending on the environnement's colors the user put the mesh, it can be hard to see it.

    I managed to do it but with no alpha taken into account for now (I'm still working on it).

    With your solution, I can make it even more flexible (the user can choose full wireframe or not).

    Posted 2 years ago #

Reply

You must log in to post.