BASIC

Author Topic: 3D shading and environment test  (Read 16259 times)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4143
    • View Profile
    • Portfolio
Re: 3D shading and environment test
« Reply #15 on: 2012-Jul-29 »
me too me too, keep me updated too! Just because you all lost that day dosen´t mean you are going to skip me! :P :-[

ps: that is really interesting Kanonet, the specular and diffuse! I will wait for the next iteration of GLB as currently I´m only doing 2d stuff, but heck, all this 3d stuff is bugging my mind!
« Last Edit: 2012-Jul-29 by erico »

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: 3D shading and environment test
« Reply #16 on: 2012-Jul-29 »
erico, I am more intersted in designing the texture rather than fix texture. For now, you are welcome to submit you own creative versions.

kanonet, I have used your libraries but disconnected again so that I can product the desired shadows and spots. Either way, I don't to get too carried away with the graphics again without having some sort of game play at least to test and administer. Last time we chatted I had asked you about a sample net program because it's neat to have the lib but pointless with a program.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1579
  • Particle Hawk
    • View Profile
Re: 3D shading and environment test
« Reply #17 on: 2012-Jul-29 »
Hi guys,
Looking good matchy!

I have been testing bump mapping alot, and i would have to say that ericos approach can be effective.
Inducing the height differences on the texture this way, is an effective although quick and dirty solution.

The key is to have at least 2 very contrasting grey colors.
Where the 2 colors adjoin, this is where specifically the "bump" will map to your surface.

As opposed to black and white, as these can cause anomalies, inducing invisible surfaces.

Below are two examples of bump maps.
One of these screenshots uses a wide variation of grey colors.
The other is using only 2 colors.



[attachment deleted by admin]
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: 3D shading and environment test
« Reply #18 on: 2012-Jul-29 »
Okay Helmos, here are some samples. Without bump, with bump and original large texture.  :)

[attachment deleted by admin]

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: 3D shading and environment test
« Reply #19 on: 2012-Jul-29 »
Here are screenshot with no bump, bump and alt bump.

[attachment deleted by admin]

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: 3D shading and environment test
« Reply #20 on: 2012-Jul-29 »
What about the blue tinge that LOADBUMPTEXTURE creates. If it is LOADSPRITE normally then the second textured in overlayed (I found....handy!).
 

[attachment deleted by admin]

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1579
  • Particle Hawk
    • View Profile
Re: 3D shading and environment test
« Reply #21 on: 2012-Jul-29 »
Good question, I'll do some more testing.
I suspect this is happenning when you use more grey variations.
Ie. distorted grey bump maps, as opposed to bump maps with only 2 colors.

I'm not 100% sure, I'll test in a few hours.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4143
    • View Profile
    • Portfolio
Re: 3D shading and environment test
« Reply #22 on: 2012-Jul-29 »
Within 3d packages, that blue tinted one is an image normal map, similar to a bump map when it comes to results.
Can GLB read those?

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1579
  • Particle Hawk
    • View Profile
Re: 3D shading and environment test
« Reply #23 on: 2012-Jul-29 »

LOADBUMPTEXTURE is not the cause of the blue tint.
I am actually having a hard time reproducing this effect.  :blink:
Its odd because i used to get this alot too.
Perhaps it is the map, or lighting causing it.

In order for me to figgure this out for you, i will need the object, the texture and the bumpmap.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4143
    • View Profile
    • Portfolio
Re: 3D shading and environment test
« Reply #24 on: 2012-Jul-29 »
Inside a 3d package, let´s suppose you have an object full of stuff, bumps, displace, high poly count, etc.
Suppose you would like to export this object into a reduced poly version + bump and texture, then, it is usual to export a normal map like that tinted blue image so it simulates those missing polygons.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1579
  • Particle Hawk
    • View Profile
Re: 3D shading and environment test
« Reply #25 on: 2012-Jul-30 »
@erico
The blueing is something to do with opengl directly.
I just cant remember what exactly i did to fix it with my software.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1579
  • Particle Hawk
    • View Profile
Re: 3D shading and environment test
« Reply #26 on: 2012-Jul-30 »
The reason i am posting this, is because if the order here is different; you may get mixed results of rendering, an error/crash, or possibly blueing.
Ever since i ordered the commands in this way, i get no rendering problems at all.
This is the order in which i rendered the objects:

Code: GLBasic [Select]
X_MAKE3D
X_CAMERA
X_SPOT_LT -1 //note: not 100% compatible with celshading. Also note, other ADDITIONAL lights will produce EXTRA darkness on the bumped object!
ALPHAMODE
X_SCALING
X_CULLMODE
X_MOVEMENT
X_SETTEXTURE t1,t2
X_DRAWOBJ

Again, as i said earlier if you still get blueing, when you do not want this result send me the obj/tex/bump or post it here and i will check it out.

Here is the results(screenshot) without a texture, and only a bumpmap(notice, no blue surface)

edit: ps. i will test your textures now that i have some time...be back in a few with the results.

[attachment deleted by admin]
« Last Edit: 2012-Jul-30 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4143
    • View Profile
    • Portfolio
Re: 3D shading and environment test
« Reply #27 on: 2012-Jul-30 »
Bump and normal image map is the same on my end(as far as results on a 3d soft).
The normal map is actually able to produce diagonals in a better fashion then the bump.

Reason it has a mix of 3 colors instead of only 2 from the black and white bump.

Of course open gl will accept the blue normal stuff when it comes to games, as it is the standard on reducing million polygons to few polygons + normal image map. Direct X should accept it too.

The normal image map (blue stuff) is only actually important when reducing details from packages, not important at all when building polygons by code, since you are building what you actually need. In this case, that you are building the polygons straight to the game, either by code or software, a bump will do. Normal image map is only important when exporting and reducing, lets say, a Zbrush 3 zillions polygons model and displaces for a game.

Which brings me the question... applying a bump map (BW black and white) and applying an image normal map (blue stuff) actually requires different reading to perform correctly. Can GLB read the normal one? By the examples, it seems the BW stuff goes ok.

According to what Matchy posted, it is hard to read the bump, as that requires movement from the lights, so I will give a go on simple 3d object display I did over a Gernot´s youtube example to give it a try. But for sure, what Matchy got on the normals looks to me as normals map being used somehow as texture and colours, which raised my first ever question on an attempt to use image normal map :S 

edit 2: The normal image map, the blue stuff, combines 3 colors in an attempt to tell the renderer where the normals(fake normals here, not real polygon ones) are going over the surface, so you get a better 3d feeling then the BW stuff, which only attempts for height and not diagonals.
« Last Edit: 2012-Jul-30 by erico »

Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: 3D shading and environment test
« Reply #28 on: 2012-Jul-30 »
Helmos, The texture and map have been posted in this thread and the object is a simple quad. When I moved, there doesn't seem to be any change in the bump lighting, just the yellow/blue shading.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1579
  • Particle Hawk
    • View Profile
Re: 3D shading and environment test
« Reply #29 on: 2012-Jul-30 »
@matchy:
Ok i made a quad object(2 triangles, size 256x256), and i used your textures and bumpmaps(i altered the size and posted them in texture.rar below).
The textures need to be power of 2, (ie. 64x64,128x128, etc), otherwise your texture will not scale properly on an object of same size.
I fixed the images the best i could, in the .rar file.(not perfect because i had to rescale them in mspaint)


[attachment deleted by admin]
« Last Edit: 2012-Jul-30 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)