RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
1.01k stars 175 forks source link

normal mapping /bump mapping #536

Open TheLonetrucker opened 8 years ago

TheLonetrucker commented 8 years ago

hey I know Box posted a tutorial but it seems like its not as much as really a bump mapping... I would be willing to help Test any Features around bump mapping As I know how to make a bump map.. I would think the newer ogre as this ability... here are some examples fu05jnb without normal map z5zcooa with normal map
hv6dorq and the normal map texture example 1 vtj9dog lagdv08 some examples Credits to photos Head photo Wikipeda

normal mapped random stuff dogebuilt on truckmodshop

refrence materials http://www.rigsofrods.com/wiki/pages/Bump_map_shader accessed On 07/01/2016 11:40 AM

https://en.wikipedia.org/wiki/Normal_mapping accessed On 07/01/2016 11:32Am

https://en.wikipedia.org/wiki/Normal_mapping

http://truckmodshop.proboards.com/thread/162/3d-models?page=125 accessed On 07/01/2016 AT 11:10AM

Speciesx commented 8 years ago

This is not a issues, you should post your tutorial here http://www.rigsofrods.com/forum.

TheLonetrucker commented 8 years ago

It is a issue I would like A better implantation Into rigs of rods for bumpmapping

disloyalpick commented 8 years ago

Also normal mapping on vehicle meshes is not possible(yet?)

ohlidalp commented 8 years ago

@TheLonetrucker What objects would you like to use normal mapping for?

For vehicles, we have managed-materials: http://www.rigsofrods.com/wiki/pages/Truck_Description_File#Managedmaterials. Simply specify the filename for normal-map and normal mapping will be enabled. EDIT: Derp, managed mats don't support normal-mapping.

For other objects, we currently don't have any out-of-the-box solution. Our 3D engine (OGRE 1.9) requires supplying your own shader code, which is a very advanced task.

DarthCainRor commented 8 years ago

@only-a-ptr What? How does one specify normal maps in managed materials? It only has placed for the diffuse, specular, and damage, when applicable. The KME fire truck has a written shader code in it for bump mapping, but as far as I know only worked .37. http://www.rigsofrods.com/repository/view/2502

ohlidalp commented 8 years ago

@DarthCainRor :blush: I mixed it up with terrain material generator in my head.

ghost commented 7 years ago

This is more of a "bug report" than a "request" but I figured here would be the best place to post what I recently discovered.

While converting terrains to 0.4 and reworking textures, I found out that normal maps seem to actually work on OpenGL, while on DirectX they don't:

Map used for testing: https://archives.rigsofrods.org/repo/0.4-Terrains/MRY11-RaceTrack-BetaTest-1-04.zip

DirectX: screenshot_2017-08-09_15-33-01_1 OpenGL: screenshot_2017-08-09_15-34-01_1

I also tested @DarthCainRor's normal map test material with different results:

DirectX: screenshot_2017-07-29_21-53-36_1 OpenGL: screenshot_2017-07-29_21-52-18_1

ohlidalp commented 7 years ago

To date, RoR doesn't have any built-in support for normal mapping (or more generic bump mapping). Modders need to bring their own shaders and link them to OGRE materials.

Novadays, shaders need to be written in GLSL (for OpenGL) or HLSL (for DirecX). In the Dx9/OpenGL2 times (which overlaps with RoR's famous 0.38+ era), there was another choice, Cg from nVidia, but that's a long obsolete technology today: https://developer.nvidia.com/cg-toolkit

Nonetheless, OGRE 1.9 still supports Cg (IDK what version) and majority of shaders in RoR seem to be Cg. If any of them aren't working, I suggest looking into RoR.log for OGRE errors reporting Cg problems. This is an OGRE issue, not RoR issue.

@Michael10055 The second pair of screenshots feels like DirectX is actually working right and OpenGL has some ugly specularity issue. But that's just me and the static screenshots.

ghost commented 7 years ago

Here's another example: DirectX: screenshot_2017-07-26_13-37-48_1 OpenGL: screenshot_2017-07-26_13-34-22_1

EDIT: Just reread what you wrote...I blame the lack of sleep. 😆
Darth's test materials probably isn't setup correctly since there's been no proper way to test them.

Speciesx commented 7 years ago

@Michael10055 Actually it's a OpenGL "bug". On OpenGL Normal Maps are always on, even when NormalMappingEnabled are disabled, while on DirectX NormalMappingEnabled must be enabled in the OTC file. DirectX: ror_2017_08_10_17_13_47_953

ohlidalp commented 7 years ago

@Speciesx Oh, right, I forgot OgreTerrain has built-in normal mapping support. So we have that.

ghost commented 7 years ago

@Speciesx Ah, completely forgot about that, thanks! I'll update the download.