• 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 … 3 4 5 6 7 … 32 Next »
AutoUV shaders [updated: 05/13/2020]

 
  • 1 Vote(s) - 5 Average
AutoUV shaders [updated: 05/13/2020]

linkoboy
Offline

Junior Member

Posts: 6
Threads: 1
Joined: Oct 2016
#42
10-23-2016, 11:23 AM (This post was last modified: 10-23-2016, 02:04 PM by linkoboy.)
Hi everybody,

If you are interesting to have a shader that show normal like in this picture :



I'll share to you this two files that I've modified from wings 3d 1.5.4 :
vertex_color.vs and vertex_color.fs.

I put some objects, a torus a sphere and a cone on the [X-Z] ground.
Link to the test scene : test_norlmal.wings

For me, the up axis is [Y]. I'm still using Wings 3D v1.5.4.

I've taken this shaders : vextex_colors.vs and vertex_colors.fs and just modified a little to have this result (see attached 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.

Best regards


Attached Files Thumbnail(s)
   

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

Users browsing this thread: 8 Guest(s)



Messages In This Thread
AutoUV shaders [updated: 05/13/2020] - by micheus - 10-22-2015, 08:55 PM
RE: AutoUV shaders - by tkbd - 10-25-2015, 02:18 AM
RE: AutoUV shaders - by micheus - 10-25-2015, 01:14 PM
RE: AutoUV shaders - by dgud - 10-26-2015, 10:43 AM
RE: AutoUV shaders - by micheus - 10-26-2015, 03:47 PM
RE: AutoUV shaders - by dgud - 10-26-2015, 06:59 PM
RE: AutoUV shaders - by tkbd - 10-27-2015, 12:59 PM
RE: AutoUV shaders - by Nova - 10-27-2015, 09:21 PM
RE: AutoUV shaders - by micheus - 10-28-2015, 12:46 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 10-29-2015, 07:09 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 11-06-2015, 12:55 AM
RE: AutoUV shaders [updated: 10/29/2015] - by Nova - 11-07-2015, 08:24 AM
RE: AutoUV shaders [updated: 10/29/2015] - by Nova - 11-07-2015, 09:15 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 11-08-2015, 02:05 AM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 11-10-2015, 09:56 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 11-19-2015, 03:19 AM
RE: AutoUV shaders [updated: 10/29/2015] - by tkbd - 11-19-2015, 11:21 AM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 11-21-2015, 01:33 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 11-21-2015, 03:18 PM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 11-21-2015, 08:47 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 11-23-2015, 03:54 PM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 12-04-2015, 04:21 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 12-04-2015, 12:50 PM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 12-04-2015, 01:40 PM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 12-05-2015, 03:35 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 12-05-2015, 09:14 AM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 12-05-2015, 01:55 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 12-05-2015, 03:58 PM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 12-06-2015, 12:47 AM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 12-08-2015, 05:04 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 12-08-2015, 06:49 PM
RE: AutoUV shaders [updated: 10/29/2015] - by Kagehi - 12-09-2015, 12:02 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 12-23-2015, 10:28 AM
RE: AutoUV shaders [updated: 10/29/2015] - by ggaliens - 12-23-2015, 02:53 PM
RE: AutoUV shaders [updated: 10/29/2015] - by oort - 10-20-2016, 08:43 PM
RE: AutoUV shaders [updated: 10/29/2015] - by dgud - 10-20-2016, 08:58 PM
RE: AutoUV shaders [updated: 10/29/2015] - by oort - 10-20-2016, 09:02 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 10-21-2016, 03:55 PM
RE: AutoUV shaders [updated: 10/29/2015] - by oort - 10-21-2016, 08:56 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 10-21-2016, 09:00 PM
RE: AutoUV shaders [updated: 10/29/2015] - by oort - 10-21-2016, 09:04 PM
RE: AutoUV shaders [updated: 10/29/2015] - by linkoboy - 10-23-2016, 11:23 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 10-23-2016, 01:46 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 10-24-2016, 05:49 AM
RE: AutoUV shaders [updated: 10/29/2015] - by oort - 10-25-2016, 01:26 PM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 10-25-2016, 07:55 PM
RE: AutoUV shaders [updated: 10/29/2015] - by oort - 10-26-2016, 03:00 AM
RE: AutoUV shaders [updated: 10/29/2015] - by dgud - 10-26-2016, 09:57 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 10-26-2016, 03:50 PM
RE: AutoUV shaders [updated: 10/29/2015] - by dgud - 10-26-2016, 09:13 PM
RE: AutoUV shaders [updated: 10/29/2015] - by oort - 10-27-2016, 12:21 AM
RE: AutoUV shaders [updated: 10/29/2015] - by rwoods - 06-22-2019, 02:43 AM
RE: AutoUV shaders [updated: 10/29/2015] - by micheus - 06-22-2019, 03:50 PM
RE: AutoUV shaders [updated: 10/29/2015] - by rwoods - 06-22-2019, 10:08 PM
New texture shader: Image Mixer - by micheus - 05-13-2020, 10:31 PM
RE: AutoUV shaders [updated: 05/13/2020] - by tkbd - 05-21-2020, 11:43 AM

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

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode