Wings 3D Development Forum
AutoUV shaders [updated: 05/13/2020] - Printable Version

+- Wings 3D Development Forum (https://www.wings3d.com/forum)
+-- Forum: Wings 3D (https://www.wings3d.com/forum/forumdisplay.php?fid=1)
+--- Forum: Interface & Usage (https://www.wings3d.com/forum/forumdisplay.php?fid=3)
+--- Thread: AutoUV shaders [updated: 05/13/2020] (/showthread.php?tid=1433)

Pages: 1 2 3 4 5 6


RE: AutoUV shaders [updated: 10/29/2015] - oort - 10-21-2016

OK Thanks... Sad


RE: AutoUV shaders [updated: 10/29/2015] - linkoboy - 10-23-2016

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


RE: AutoUV shaders [updated: 10/29/2015] - micheus - 10-23-2016

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


RE: AutoUV shaders [updated: 10/29/2015] - micheus - 10-24-2016

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


RE: AutoUV shaders [updated: 10/29/2015] - oort - 10-25-2016

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


RE: AutoUV shaders [updated: 10/29/2015] - micheus - 10-25-2016

(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


RE: AutoUV shaders [updated: 10/29/2015] - oort - 10-26-2016

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


RE: AutoUV shaders [updated: 10/29/2015] - dgud - 10-26-2016

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)


RE: AutoUV shaders [updated: 10/29/2015] - micheus - 10-26-2016

(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


RE: AutoUV shaders [updated: 10/29/2015] - dgud - 10-26-2016

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'