Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Specular Mapping in DBPro

Author
Message
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 14th Jun 2006 14:15 Edited at: 14th Jun 2006 14:37
here is how(use attached images):
Correct me if im wrong, and tell me your opinions.


If you want to see bump mapping work on this object, change the code with below:



To see the magic of alpha mask try this code:

Attachments

Login to view attachments
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 14th Jun 2006 22:12
so 32 people visited and tried this, and no terrific comments at all.. so i assume this is the right way to do it?
Merk
18
Years of Service
User Offline
Joined: 5th Feb 2006
Location:
Posted: 15th Jun 2006 08:41
Ah, I just posted on the forums asking about alphamapped sphere mapping. Excellent, thank you cucumber this was exactly what i was looking for!
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 15th Jun 2006 11:35
arent i handy
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 15th Jun 2006 11:45
I'm far too lazy to download files, copy and paste code, organize everything, and compile and run my own projects. Post screenies.

CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 15th Jun 2006 11:50
im too lazy to find a good angle to show what the code does, press on print screen button, resize the picture, find a suitable web space to load and paste it in this forum.
you can see what the code does in an animation rather than a still image.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 15th Jun 2006 16:53 Edited at: 15th Jun 2006 16:54
CuCuMBeR, well done.
I've tried specular mapping and it works here, but I found some problems:

- I cannot tweak the specular level (it only depends on the distance to the light source),

and

- I cannot tweak the brightness of the non-specular part (it is always equally lighted).

This is an example where
1 - Specular lighting, oceans and lakes.
2 - non specular surface is always equally lighted.



I've used Earth texture for stages 0 & 3, a black texture for stage 1, and the specular map for stage 2.

I guess it is "as it is", it still works if you don't need total darkness but, do you have any advice anyway?

Attachments

Login to view attachments
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 15th Jun 2006 17:46 Edited at: 15th Jun 2006 18:50
Morcilla:
1. you tweak specular lighting amount with the specular map, not with the dbpro lights, the whiter the areas the lighter they look.

Set these to your earth sphere object before you do any blending, it will fix the darkness difference between a blend mapped and normal textured object:
to see it, set ambient level of the environment to a very low level.
Set Object Diffuse o, Rgb(128,128,128)
Set Object Emissive o, Rgb(128,128,128)
Set Object Specular o, Rgb(128,128,128)
Set Object Ambience o, Rgb(128,128,128)

And for fun, try set bump mapping on with a greyscale bump map image to the oceans.

EDIT: uhmm..well, that doesnt fix the 2nd issue..ill try to find a solution, probably another alpha map..
EDIT2: err..i dont think i can blend 2 alpha maps, try reducing the white on your alpha map(your specular map in this case) to a very low brightness like if 0 is complete black make the lands alpha to somethin 1 to 10 grey and that darkends the lands as well. but not pitch black..
also i found, if you use a gradient map and blend a night earth map into the day earth map, you get a cool day to night cycle

Attachments

Login to view attachments
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 15th Jun 2006 19:03 Edited at: 15th Jun 2006 19:08
Set Object Diffuse o, Rgb(128,128,128)
Set Object Emissive o, Rgb(128,128,128)
Set Object Specular o, Rgb(128,128,128)
Set Object Ambience o, Rgb(128,128,128)

Doesn't seem to work. Ambient light is set to 0. Also I forgot to tell you I'm still with 5.9, son there may be slight differences.

Yep, decreasing the brigthness of the specular map solves partially the issue 2 (no pitch black, unfortunately), but I still have no control on how much specular level has the water. (I mean I don't know how to do the "SET OBJECT SPECULAR POWER Object Number, Power" command).

Gradient map? I've been playing with the night-day cicle but the night map is always seen from the lighted side of the earth
That would be cool So far I thought shaders were needed to made such an effect.

[Edit]
I didn't saw the picture, very cool!
That should solve perfectly the no-black pitch problem. I could be using this.
Also this could be linked to the code snippets section, since it seems to work very well.
Good Job.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 15th Jun 2006 19:46
you know things would be alot easier if we could blend maps on the fly instead on a mesh.

Quote: "I mean I don't know how to do the "SET OBJECT SPECULAR POWER Object Number, Power" command"

as again darken the white shade of the ocean parts to a reasonable grey and do variations for testing. it will effect the specular power as well.Ooor i just dont understand what you are trying to.

And yes on the second thought, combining a day and night cycle sounds better than trying to solve your 2nd issue
ill post a source with better media as i make some.

Finally i was thinking the shader support was better than 5.9 or below, but now i think it sucks further without the create pixel and create vertex shader from file commands.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 16th Jun 2006 14:35
I'm looking forward to see the example. I still don't know how to apply that gradient map.

I checked your previous threads like "Correct usage of Blend Mapping" : http://forum.thegamecreators.com/?m=forum_view&t=80008&b=1

There's some lack of info about how to use blend modes properly, you are doing an excellent job.

Prepare to be credited for your know-how contribution if I finally use the blend modes like you show us here
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Jun 2006 15:40 Edited at: 19th Jun 2006 15:41
Quote: "Ooor i just dont understand what you are trying to"


Here is a picture showing an example:



As you can see, the higher the specular power, the more concentrated the specular glare is.

That mixed with the specular color let us tune the amount of bright and how fast that bright diminishes.

With the blend mapping I only achive dull specularity, like if that white ocean part of the specular map should be "whiter than white" to look similar.

Attachments

Login to view attachments
Red Ocktober
20
Years of Service
User Offline
Joined: 6th Dec 2003
Location:
Posted: 19th Jun 2006 23:28
nice thread Cuc... usefull and helpfull topic...

--Mike
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 20th Jun 2006 18:08
well, im sorry i couldnt manage to get a well-arranged demo to show. i mostly get stucked about scrolling the gradient alpha map texture. otherwise it gets a good still day night effect but when you animate, it sucks.
anyways for the blend mapping i suggest you read these articles about directx multi texturing, i assume they are mostly the same with DBPro as its based on directx:
http://www.gamasutra.com/features/19981009/multitexturing_01.htm
http://www.nevrax.org/doxygen/da/da9/driver__direct3d__material_8cpp.html
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 20th Jun 2006 18:29
Hey, nice thread you have here, it motivated me to do some work on planets , and as i shuffled your example to work like a planet and finally got it working with the sea reflecting the lights specular and added a cloud layer over the top, i found that i couldent scroll any of the texture layers on my model, has anyone else had this problem? cause ill post the media+code if you wish, and ignoring that slight problem.

I attemted to add one of evolved`s per pixel light shaders which doesnt occupy any texture slots and allows me to have half of the planet pitch black however, if i apply this effect to my object i find that only the base texture is visible, my water specular highlighting and cloud layers have vanished, did i do something wrong?

Hallowed are the ori.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 20th Jun 2006 19:38 Edited at: 20th Jun 2006 19:39
the point is not using shaders.
if you use one, then your shader over-writes every texturing made in dbpro, sooo you better write your own shader to suit your needs or to get contended with other shaders, which cant do specifically what you want, but the things which they were supposed to.
However, i tried but personally could not manage the above thingy about planets without shader support.So if anyone can, please share.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 22nd Jun 2006 13:06 Edited at: 22nd Jun 2006 13:19
Hi CuCuMBeR,
this works quite well so far. I managed to have day-night cycle with the method already described, but tweaking the textures.

That is, using the first source of this page :

- base image : day map
- ref image : black texture
- mask image : inverse of overlay image
- overlay image : night map

So an inverse image of overlay as a specular map seems to balance the night map when it reaches the light side.
Results are acceptable to me. I might be posting a picture at my WIP thread.

[edit] I haven't had any succes with bump mapping. I tried greyscale as well as dot3 bumpmaps, but it looks terrible.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 22nd Jun 2006 14:34
Quote: "I haven't had any succes with bump mapping. I tried greyscale as well as dot3 bumpmaps, but it looks terrible. "


have you tried just using a green, red or blue colors as you would do the greyscale pic, not so dark when done with green.

I'm not getting you down am I, Ho Look! another fancy Door?
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Jun 2006 15:28
Morcilla:
The Image i posted above somewhere about the night lights was based on the first source of this page as well. But i just wanted to improve it because i was still able to see the lights on the day part alittle bit. Probably its somethin to do with the media, but couldnt make it disappear totally.

Anyways, if its acceptable for your case, im glad if i could help.

About bump mapping, strangely it works perfectly with me about the first source again.
I have gforce fx5200 with latest driver and latest directx.
Indeed, the bump image i used is from one of YOUR shaders just converted to greyscale as far as i remember.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 22nd Jun 2006 15:56 Edited at: 22nd Jun 2006 15:57
HowDo:
Thanks for the suggestion, but no luck (I got a green earth lol)

CuCuMBeR:
No lights at the day part, but yes, they didn't dissappear completely.
They become some diffuse grey dots, like polluted cities
But I think that the contrast with the night side helps to fix that sensation.

No bumpmapping luck. I get a white & black object with mostly white (untextured) changing areas (where the bump should be).
I'm running on ati 9700pro...Uh.
Could it be that I'm still with 5.9 here? Must be that, although it would be nice to know that it is working for others.
I don't remember to have used greyscale images for bumpmapping, perhaps is somebody else's shader?
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 22nd Jun 2006 16:30 Edited at: 22nd Jun 2006 16:32
hmm, i found out why the gradient image doesnt give a good day-cycle effect because i was trying to scroll the texture stage which i noticed somebody posted in the bug reports that scrolling texture stages doesnt work.

Login to post a reply

Server time is: 2024-04-20 03:14:29
Your offset time is: 2024-04-20 03:14:29