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 / Normalmaping for DarkBais?

Author
Message
Gamemaster
15
Years of Service
User Offline
Joined: 25th Mar 2009
Location:
Posted: 11th Apr 2009 10:39
Kann man in DarkBasic auf irgendwie Normalmaping verwenden.

schwert_n.dds
INFO: Normalmaping schärft die texturen und lässt sie mehr 3d aussehen;

Textur 2.

schwert.dds
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Apr 2009 14:06
Quote: "Kann man in DarkBasic auf irgendwie Normalmaping verwenden."


Yes.

Quote: "INFO: Normalmaping schärft die texturen und lässt sie mehr 3d aussehen;"


Agreed. It's a very easy way of adding more realism to your scene. You will need to find a normal mapping shader and apply it to your objects.

If you need help with this post back.
Gamemaster
15
Years of Service
User Offline
Joined: 25th Mar 2009
Location:
Posted: 11th Apr 2009 22:06
Danke schonmal im Voraus;
Also wie funktioniert das den genau ?
Und welche plurings werden gebraucht ?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Apr 2009 23:22
Quote: "Danke schonmal im Voraus;"


You're welcome.

Quote: "Also wie funktioniert das den genau ?"


Have a look at the attached demo. Any questions - just ask.

Attachments

Login to view attachments
ID_OK
16
Years of Service
User Offline
Joined: 3rd Sep 2007
Location:
Posted: 12th Apr 2009 16:37
Hi,

I have of daz3d a 3D model.

This model owns 46 groups, 28 Colormaps and 28 Bumpmaps.

With transform of Wavefront *.obj in *.DBO with Ultimate Unwrap3D are lacking the Bumpmaps (only Texture stage 0).

How add I the Bumpmaps to that Scene in DrakBasicpro for more realism?

Thank you.
Gamemaster
15
Years of Service
User Offline
Joined: 25th Mar 2009
Location:
Posted: 12th Apr 2009 21:37


Das ist mein derzeitiges projekt ,die räume sind noch ohne normalmaping .
Thank you Gandalf;

Und hier gibts noch ein pluring für Gimp , normalmaping:
[href]Normalmap-Plugin(http://nifelheim.dyndns.org/~cocidiu...ormalmap-win32)[/href]
ID_OK
16
Years of Service
User Offline
Joined: 3rd Sep 2007
Location:
Posted: 12th Apr 2009 23:07
Hallo,

das *.dbo File Format supported mehrere Texture Layer. Komplexe Level-Objekte umfassen Colormap + Bumpmap + Lightmap. Mit
Unwrap3D enthalten die im *.dbo File Format gespeicherten Objekte nur die Colormaps.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Apr 2009 13:51 Edited at: 15th Apr 2009 13:52
Quote: "Hi,

I have of daz3d a 3D model.

This model owns 46 groups, 28 Colormaps and 28 Bumpmaps.

With transform of Wavefront *.obj in *.DBO with Ultimate Unwrap3D are lacking the Bumpmaps (only Texture stage 0).

How add I the Bumpmaps to that Scene in DrakBasicpro for more realism?

Thank you. "

Did you actually read the reply to your own post located here?

Your signature has been erased by a mod because it is way too awesome!
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Apr 2009 14:17 Edited at: 15th Apr 2009 14:35
Quote: "Hallo,

das *.dbo File Format supported mehrere Texture Layer. Komplexe Level-Objekte umfassen Colormap + Bumpmap + Lightmap. Mit
Unwrap3D enthalten die im *.dbo File Format gespeicherten Objekte nur die Colormaps. "


That may be true.

Are you saying that the bumpmaps are ignored when you apply the shader to your level objects? If so, could you post a simple example of your media, i.e. a simple object with just one colormap and just one bumpmap? Then we can check to see for ourselves what your problem is - and possibly offer a solution.

Perhaps someone else knows how to do this using daz3d, Wavefront and Ultimate Unwrap3D? I don't as I have no experience of those programs.

Edit As an experiment I've just created a simple cube, applied a color map to stage 0, a bump map to stage 1 and then saved the object in *.dbo format. I then loaded the object and applied a bumpmapping shader to it and it worked perfectly first time. So it seems your problem may be how to get your models loaded correctly into DBPro in the first place.
ID_OK
16
Years of Service
User Offline
Joined: 3rd Sep 2007
Location:
Posted: 18th Apr 2009 15:52
I want load in DarkBasicPro with blue Normalmapping the following model of DAZ3d

http://www.daz3d.com/i/3d-models/-/starcarrier?detail=7061&_m=d

Crash with load effect, set bump mapping on
and with .dbo

load object "untitled.dbo",1
load image "SCfrontwill.jpg",1
laod image "SCfrontwllbump.jpg",2
texture object,1,0,1
texture object 1,1,2
set bump mapping on 1,2
not applicable

Load UV set?

*.dbo only functions with Colormap.

How to these Level StarCarrier load with 28 Colormap and 28 Bumpmap?
ID_OK
16
Years of Service
User Offline
Joined: 3rd Sep 2007
Location:
Posted: 18th Apr 2009 16:00
Quote: "Edit As an experiment I've just created a simple cube, applied a color map to stage 0, a bump map to stage 1 and then saved the object in *.dbo format. I then loaded the object and applied a bumpmapping shader to it and it worked perfectly first time. So it seems your problem may be how to get your models loaded correctly into DBPro in the first place. "


How add I at bump map to stage 1 and then saved the object in *.dbo format? Yet has that not operates.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 24th Apr 2009 17:21 Edited at: 24th Apr 2009 17:23
Hey Green Gandalf, great shader I must say. Glad to know also that you not only know HLSL

I like the shader very much because of the useful parameters as ambient light, light color and specularity.

However, I've encountered an issue with specularity that, in my opinion, ruins somehow the results, and that shouldn't be happening at first glance.

I've set up a little example so you can see what I mean. Specularity only shows from one side, it dissapears at certain distance, or it could be said that it has preference for a particular side of the object, lighted here from X axis:



I've assigned Control and Shift keys, to easily change the point of view. Camera moves with the arrow keys.
The project files and media are the ones you posted above.

Please can you help me with this? Thanks a lot
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Apr 2009 23:34
Quote: "How add I at bump map to stage 1 and then saved the object in *.dbo format? Yet has that not operates. "


Use a shader - not the set bump mapping on command.

Quote: "Glad to know also that you not only know HLSL"


You're right - I've been experimenting with using Google.

Quote: "Please can you help me with this? Thanks a lot"


I'll have a look - but probably not tonight as I've drunk all my beer and have now resorted to sherry.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Apr 2009 00:41
Quote: "I'll have a look - but probably not tonight as I've drunk all my beer and have now resorted to sherry."


OK, despite the sherry I've had a look and I see what you mean.

Actually I think the one where the specular reflection "moves" is correct - but certainly the "left" and "right" views can't both be right.

I've noticed this before and thought I imagined it - or that I was using an old, bugged, normal map. However the effect is even more obvious if you use a "flat" normal map where every pixel is RGB = (128, 128, 255), so it can't be the normal map.

I agree there's a bug somewhere. I'll investigate. Thanks for pointing it out so convincingly.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 25th Apr 2009 13:02 Edited at: 25th Apr 2009 13:04
Thanks so far for your quick answer, I understand that the end of the day is not the best moment

Quote: "Actually I think the one where the specular reflection "moves" is correct"

Well, I do not think so really, because in the 'right' side (the Control key one), that specularity movement behaves differently, and much more natural.

On the wrong side (the Shift or 'left' side), the specularity skids to the dark side, until it eventually dissapears, while it should stay more or less in the bright side of the object.

If we raise up the specularity, this can be noticed. It can be seen clearly here, and even more using that RGB = (128, 128, 255) (I called it "neutral_normal.jpg", attached to this post):


Quote: "I agree there's a bug somewhere. I'll investigate. Thanks for pointing it out so convincingly."

No problem, thanks for your time. I thought it was hard to explain, besides I had to prove it
Regarding this, my suspects go for the 'CameraPosition':

or perhaps the auto-feeding of the matrices, oh well I have no idea

But I know that whis can give you some clues (or either know you out, lol):



The basic difference is the position of the object:



Now it is nearer the origin (0,0,0), and the specularity behaves much properly!
What do you think?

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Apr 2009 14:21
Quote: "Regarding this, my suspects go for the 'CameraPosition':"


You are absolutely right. I was careless in my use of eyePos in the shader.

In the shader just change this:



to this:



I also changed your original dba code to this so I could see the effects of left versus right more easily:



Let me know if this works better.

Thanks for helping to identify the problem.

This has been troubling me for some time and may be affecting several of my bump mapping shaders. More checking ...
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 25th Apr 2009 20:54 Edited at: 25th Apr 2009 20:57
Glad to help you to find the cause
I did the changes you said and everything looks fine now. Great

I'd like to improve this shader by adding a specular map, but I'm having some troubles. I've arranged a new sampler called 'sMapSample', and then in the pixel shader, I've added a 'specular_normal' like this:



So the reflect is calculated with this value as:



But it seems that I'm missing the approach so far. The specular shine is coming from one side, once again.

This is the .fx code:



And this is the DBPro code, ther should be no error here, I just added a third texture stage with the file "test_spec.jpg" (attached below):



Thanks so far for all, please can you help me telling me how do I add a specular map?

Oh, one thing, I know it is about beer time, so no hurries, but leave something for the rest of us
Cheers

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Apr 2009 23:06
Quote: "I know it is about beer time"


You're correct - not only that but I'm cooking supper tonight as well. It's quite useful having a wireless connection - I can keep an eye on the cooking as well as try to answer your questions.

I think you've misunderstood how your specular map is supposed to work.

Your image suggests that it's a standard specular map which merely indicates which parts of the surface should have specular reflection and which should not, i.e. black is no reflection and white is full reflection. This means that it should be read into a scalar and which is then used to modify the specular intensity of the lighting.

In other words, you need something like:



to read in the value (assuming the map is simple greyscale, so you can simply use the red component). You then use it in the following lines of the shader:



In other words you are just modifying the effect of the variable "specLevel" - if your map is mostly black you may want to increase the value of "specLevel" to compensate. This is an "artistic" issue and you can experiment.

Supper is nearly ready and I'd better stop now - the above suggestions haven't been tested, so beware.


Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Apr 2009 11:31
Quote: "I did the changes you said and everything looks fine now. Great "


A slightly neater solution is to use the following two lines:



and



in the appropriate places.

I'd forgotten that DBPro fills in the fourth component of CameraPosition with the necessary "1".

[Credit due to AtomR on another thread for that. ]
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 26th Apr 2009 20:43
Quote: "The above suggestions haven't been tested, so beware."

Thanks for the warning, but everything worked great again!
I think everything is working perfectly now, although I'll let you know if I detect any issue.

Quote: "A slightly neater solution is to use the following two lines...in the appropriate places."

Roger that, improved!

Thanks again, I owe you one round
Until then, please let me welcome you to the credits section
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Apr 2009 23:04
Quote: "Thanks again, I owe you one round "


Looking forward to it.

Quote: "Until then, please let me welcome you to the credits section"


Thank you.

You'll be in mine too - rather a lot of my bumpmapping demos had that specular error so it's good to have it identified and corrected. Might take a while to track down every instance though.

I'll certainly need several of these when (before?) I've finished.
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 27th Apr 2009 21:10
Glad to be so helpful

Many thanks once again, also for explaining the concepts about the specular map.

Here is an application of the shader that I hope you enjoy

http://www.thegamecreators.com/?m=gallery_view&i=1119

Oh, I've sent you an email

Login to post a reply

Server time is: 2024-04-20 10:44:39
Your offset time is: 2024-04-20 10:44:39