• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Interface & Usage v
« Previous 1 … 10 11 12 13 14 … 32 Next »
Normal colors of "Face normal shader"

 
  • 0 Vote(s) - 0 Average
Normal colors of "Face normal shader"

linkoboy
Offline

Junior Member

Posts: 6
Threads: 1
Joined: Oct 2016
#12
10-23-2016, 11:05 AM (This post was last modified: 10-23-2016, 11:22 AM by linkoboy.)
Hi,

I finally succeeded to have the same result like in this picture ("wish.png")

I'm still using Wings 3D v1.5.4. I put some objects, a torus a sphere and a cone on the [X-Z] ground. For me, the up axis is [Y].
Test scene : ("test_normal.wings")

I've taken the shaders : vextex_colors.vs and vertex_colors.fs and modified them just a little to have this result (see "result.png")

Here is the shaders :

Vertex Shader : vertex_color.vs
Code:
varying vec3 VertexColor;
uniform int  Flag;

void main()
{
    VertexColor = gl_Normal;
    gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
}

Fragment shader : vertex_color.fs
Code:
varying vec3 VertexColor;

void main()
{
    bool flipX = false;
    bool flipZ = true;
    
    vec4 color = vec4((1.0 + VertexColor) / 2.0, 1.0);
    
    gl_FragColor.r = flipX ? 1.0 - color.r : color.r;
    gl_FragColor.g = flipZ ? 1.0 - color.b : color.b;
    gl_FragColor.b = color.g;
}

If you want flip the colors in X or Z axis, you can just trick the boolean to have the desired result.

I'll share that into the Auto UV shaders forum too.

Regards,


Attached Files Thumbnail(s)
       

.wings   test_normal.wings (Size: 46.59 KB / Downloads: 4)
.vs   vertex_color.vs (Size: 226 bytes / Downloads: 5)
.fs   vertex_color.fs (Size: 394 bytes / Downloads: 4)
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Messages In This Thread
Normal colors of "Face normal shader" - by linkoboy - 10-19-2016, 10:26 AM
RE: Normal colors of "Face normal shader" - by micheus - 10-19-2016, 03:28 PM
RE: Normal colors of "Face normal shader" - by linkoboy - 10-19-2016, 04:45 PM
RE: Normal colors of "Face normal shader" - by oort - 10-19-2016, 08:33 PM
RE: Normal colors of "Face normal shader" - by linkoboy - 10-19-2016, 09:58 PM
RE: Normal colors of "Face normal shader" - by oort - 10-19-2016, 11:38 PM
RE: Normal colors of "Face normal shader" - by micheus - 10-20-2016, 01:03 AM
RE: Normal colors of "Face normal shader" - by linkoboy - 10-20-2016, 07:00 AM
RE: Normal colors of "Face normal shader" - by oort - 10-20-2016, 08:40 PM
RE: Normal colors of "Face normal shader" - by dgud - 10-20-2016, 08:55 PM
RE: Normal colors of "Face normal shader" - by micheus - 10-21-2016, 03:40 AM
RE: Normal colors of "Face normal shader" - by linkoboy - 10-23-2016, 11:05 AM
RE: Normal colors of "Face normal shader" - by micheus - 10-23-2016, 01:54 PM
RE: Normal colors of "Face normal shader" - by micheus - 10-24-2016, 05:54 AM
RE: Normal colors of "Face normal shader" - by 3DGeek46 - 11-01-2016, 12:03 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode