Relief Mapping

Everything related to 3D programming
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Relief Mapping

Post by Samuel »

@Bananenfreak

Try this new Normal Height Map. It should get rid of the gray spot in the middle of each square.
Not sure if that was the problem you were referring to, but it was something that needed fixing.

NormalHeight.png
Image

EDIT:
I updated the original Normal Height image with this new one too.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Relief Mapping

Post by Bananenfreak »

Yeah, the Grey hearts are gone, but I still have Problems. Here are two Pictures. Both Meshes are triangulated (OGRE log said, that my cuboid is outdated, I should upgrade it as soon as possible. Perhaps this is the issue?), but only one Shows the shader correct.

Image

Image

Should I upgrade my mesh? How I can do that? With the Meshupgrader from the OGRE Command Line Tools?
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Relief Mapping

Post by Samuel »

I'm pretty sure you won't have to update the mesh.

There's a few things you need to make sure your mesh has.
The mesh requires normals, UV coordinates, and tangents.

It looks like you have the normals and UV coordinates, but are you sure you have the tangents?
Use BuildMeshTangents(#MESH) right after loading or creating a mesh to generate tangents.

If you have all three requirements then you could try updating.
I believe you just drag the mesh file onto the Meshupgrader exe or use command prompt to update.
I've never had to update a mesh. So, I could be wrong about how that's done.
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Relief Mapping

Post by PMV »

Samuel wrote:If you have all three requirements then you could try updating.
I believe you just drag the mesh file onto the Meshupgrader exe or use command prompt to update.
I've never had to update a mesh. So, I could be wrong about how that's done.
the upgrade-tool has to be called with paramter "-t" to generate tangents.
It will not generate it by default.

MFG PMV
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Relief Mapping

Post by Bananenfreak »

@Samuel:
Yes, my meshes don't have tangents. I will upgrade them as soon as possible (BuildMeshTangents() is also working).

@PMV:
How to call the Upgrader with this argument? Do I have to navigate with the CMD to it?
Image
Fred
Administrator
Administrator
Posts: 18384
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Relief Mapping

Post by Fred »

That's really cool examples !
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Relief Mapping

Post by PMV »

Bananenfreak wrote:How to call the Upgrader with this argument? Do I have to navigate with the CMD to it?
It's just a plain console program, so yes ... cmd is a possibility.
PB command RunProgram() is possible, too. So you could
write a complete GUI for it, if you want. :mrgreen:
I have done it with a .bat script.
"UpgradeMeshTool -t <SourceFile> [<DestiFile>]"
btw. i dont know it is the right name of the program, so dont copy that. :mrgreen:
If the program is called without a parameter, it will print out help.

MFG PMV
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Relief Mapping

Post by Bananenfreak »

Hey Samuel,

first of all: Really good work (As I said a few times before :) ). Here´s a Picture of my first (real) implementation:

Image

(Shadows look ugly, I don´t know... Since I updated to PB 5.20 LTS, they look ugly :D )
-I don´t want that the bark is shining, is there a possibility to adjust that?
-As you see, there´s a Problem with your shader in bottom Region of my tree trunk... Or is this a Problem with my mesh?
-In my opinion, depth is not adjustable (It does nothing...)

Greets,

Banana
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Relief Mapping

Post by Samuel »

Bananenfreak wrote: (Shadows look ugly, I don´t know... Since I updated to PB 5.20 LTS, they look ugly :D )
Are you using TextureAdditive shadows? If you are then adjust the Texture Size.
WorldShadows(Type [, Distance [, Color [, TextureSize]]])
Texture Size is by default 512 and should not be set higher than 4096.
The higher the number the better the quality.
Bananenfreak wrote: -I don´t want that the bark is shining, is there a possibility to adjust that?
In the material script try changing the set $PhongExp 64.0 to a higher value like 512.0
Bananenfreak wrote: -As you see, there´s a Problem with your shader in bottom Region of my tree trunk... Or is this a Problem with my mesh?
It looks to me like the UV coordinates aren't set right. If you have UV coordinates that are to close or to far away from each other it can cause stretching effects.
If that didn't make sense I can post a picture later that shows the issue better.
Bananenfreak wrote: -In my opinion, depth is not adjustable (It does nothing...)
Looks like you only have a Normal map. You need a height value in your map too. If your using the plugin for GIMP then there should be an alpha channel option.
Set it to inverse height to create a Normal Height Map.
It should look something like this.
Image
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Relief Mapping

Post by Bananenfreak »

1. Today I'll see over my code, it worked fine with 5.11, same code isn't working correct with 5.20 (I mean the shadows). Texturesize is set to 6144. As is said, it worked on variant Pc's with 5.11, after updating to 5.20, it does not work correct.
2. I will test this as soon as possible (I don't want the normal normal normalmap materialshining...). Is there also a way to manipulate the normal material values like emissive or so?
3. How to modify this? This stretching issue appears only in a specific range with a specific angle...
4. I'm making a new Normal height map, thanks Samuel.

EDIT:
1. Nothing was changed... I don´t understand this. It has to generate a right shadow :evil:
4. Ok, now it´s better, but still the UV Problem.
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Relief Mapping

Post by Samuel »

Bananenfreak wrote: 4. Ok, now it´s better, but still the UV Problem.
I used to have a similar problem when I first started unwrapping meshes to create a UV layout.
Here's a picture showing what a cube might look like when unwrapped onto a texture.

Image

Notice that the yellow square is quite a bit smaller then the other sides of the cube.
This is what it will look like when wrapped onto a cube.

Image

The right side of the cube uses the UV coordinates of the yellow square. Its very stretched compared to the top and left side.
I think your tree mesh has a similar problem. The scale is most likely off for some of the faces. You need to make sure they are all balanced properly.

EDIT: If you are still having issues. Could you post a picture showing the wireframe of the tree trunk?
Sometimes when you have strange face patterns it can make unwrapping a little difficult.
So, it may be easier to edit or rebuild the mesh itself and then try unwrapping again.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Relief Mapping

Post by Bananenfreak »

Yeah, I edited the UV for generating a better tree... One bark texture for the whole tree, not a filled part texture. This is normal for Designers...
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Relief Mapping

Post by Samuel »

Hello everyone,

I had a little spare time so I edited the shader a little more. You can now control the depth in real time! :D
You only need to update your material script and the PB code to the newer ones. I didn't do anything to the CG or Program Files.

It would be great if you guys could give it a quick try and make sure it still runs properly. It runs fine for me, but
I don't want to leave an example up that gives errors for others. So, It's good to have a few different people test it.

I know most users probably won't have much use for this, but I still think it's a neat looking effect. Hope you guys enjoy it.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Relief Mapping

Post by Bananenfreak »

Yes, it works :) Thank you, Samuel.
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 756
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Relief Mapping

Post by Samuel »

Thanks for checking it out. I think I've done all that I can with this shader.
So, I'll be working on some of the others that I have been pushing off to the side.

If anyone ever finds a bug or an error in this shader let me know. I'll see what I can do to fix it.
Post Reply