• 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]

Pages (6): « Previous 1 2 3 4 5 6 Next »
oort
Offline

3D Obsessed

Posts: 1,184
Threads: 69
Joined: Nov 2012
#41
10-21-2016, 09:04 PM
OK Thanks... Sad
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)
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,675
Threads: 183
Joined: Jun 2012
#43
10-23-2016, 01:46 PM (This post was last modified: 10-24-2016, 05:48 AM by micheus.)
linkoboy, the wpc_*.sub is the "guy" used to create de dialog interface that can allow the user to play with parameters like flip X or Y colours. Take a look at one of those 3d shaders file and you can add that.
I can do that late if you think it's complicated to understand, but I have a guess that you can do it. Smile
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,675
Threads: 183
Joined: Jun 2012
#44
10-24-2016, 05:49 AM
I had a time to check/test it and it is similar what I had tried before. What was going wrong is that I was porting to be used as un AutoUV shader and unfortunately it doesn't works. It seems like the the gl_normal doesn't have a valid value (it's a constant value). Maybe something must be added to the AutoUV code in order to make the normals available correctly as it works for Geometry window.

So, by now, the code cannot be used for the AutoUV shaders as the others already shared here. Sad
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
oort
Offline

3D Obsessed

Posts: 1,184
Threads: 69
Joined: Nov 2012
#45
10-25-2016, 01:26 PM
Micheus,
Thanks for trying. Too bad that it does not work in AutoUV. I have never created normal maps before. I wonder if there would be a lot of interest in this?

I guess that heightmaps are not possible for the same reason.

Would it be possible to create gloss maps?

Thanks,
oort
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,675
Threads: 183
Joined: Jun 2012
#46
10-25-2016, 07:55 PM (This post was last modified: 09-15-2019, 09:52 PM by micheus.)
(10-25-2016, 01:26 PM)oort Wrote: Too bad that it does not work in AutoUV. I have never created normal maps before. I wonder if there would be a lot of interest in this?
This dgud's post show us that someday it can be implemented. Smile

When I started to write these new 3D shaders I wondered to make possible we create normal map using them since most of them are composed by a grayscale pattern for which we add colors. The TBN (tangent/bitangent/normal) thing was new to me. I tried to find a easy way to transform those "bump" maps in normalmaps, but I didn't get success at that time.
The recent question by linkoboy bring me back that wish and because I found a nice article (Building Varga) in which the author explain a lot of maps I finally understood how I could reach that.

As a result here is a new shader filter normalmap_filter.zip that can be used to create normal maps from w3D shader maps or even from an imported image like in this sample bellow:
[Image: w3d_normal_shader.png]
Another step into something I have been "dreaming" for a while since I started to play with shaders. Smile
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
oort
Offline

3D Obsessed

Posts: 1,184
Threads: 69
Joined: Nov 2012
#47
10-26-2016, 03:00 AM (This post was last modified: 10-26-2016, 03:05 AM by oort.)
Micheus,
It is amazing what you can do... Smile

Thanks for adding this feature. Are you using Wings 2.1 in the example you are showing? Maybe my graphics card does not support displaying normal maps??? I can render with YafaRay and see the affect of the normal map but I cannot see it in Wings3D.

What settings are you using when creating the normal map? The normal map I created does not show the different colors as strong as they are in yours. I used an image like you have shown. What do the options Invert X, Invert Y, Colored Background, and Scale do?


Yes, lots of questions... Smile

Thanks,
oort
dgud
Offline

Grumpy Dev
Posts: 692
Threads: 37
Joined: Nov 2012
#48
10-26-2016, 09:57 AM (This post was last modified: 10-26-2016, 09:59 AM by dgud.)
Micheus if you have time and want to play with normals, I have a branch that doesn't work in dgud/autouv/normalmaps
But it might be a starting point, some parts of that branch might be merged already to master.

trananha91: (I have not tested now but the idea was that this should work)
You can do a fake AO bake pass by:
uv-map your model,
copy it,
hide original,
subdivide copy a pair of times,
Tools/AO,
Open Autouv window generated texture with vertex colors,
Drag generated texture to orig model (as diffuse texture)
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,675
Threads: 183
Joined: Jun 2012
#49
10-26-2016, 03:50 PM (This post was last modified: 10-26-2016, 04:06 PM by micheus.)
(10-26-2016, 03:00 AM)oort Wrote: Are you using Wings 2.1 in the example you are showing?
Yes, but it also working in 1.5.4. It doesn't uses and newest GLSL stuff, so it's compatible with old versions of Wings3D.

Quote:What do the options Invert X, Invert Y, Colored Background, and Scale do?
They are parameters I saw/used in Gimp's Nomalmap plugin. The Invert X and Invert Y are used to change the way the map digs the surface, like this:
[Image: th_referencebump_normal.jpg]

The Scale should affect the "height" data in the map changing the surface looks:


The Colored Background must be used when we are not using a gray scale image as input. In case checked it will be computed each pixel luminance, otherwise only the red channel is used.

Here is a short video showing how to use this filter:

p.s. It seems like the Invert Y must be checked to get the right effect. Someone else can confirm that? Rolleyes
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
dgud
Offline

Grumpy Dev
Posts: 692
Threads: 37
Joined: Nov 2012
#50
10-26-2016, 09:13 PM
Hmm, I don't think this should be an autouv shader, this is a command that should be available in the RMB-menu on an image in outliner?

'Convert Image Normal Map'
« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)

Pages (6): « Previous 1 2 3 4 5 6 Next »


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

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode