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.

Work in Progress / Shaders for Advanced Terrain

Author
Message
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 31st Mar 2009 09:39
GG - sorry, can't post a screenshot (still a duffer in that area)

However, all I am doing is creating a sprite (SPRITE, 1,0,0,1) within your original demo code, just prior to the 'REPEAT' loop. The resulting shadows are 'blotchy', most noticeable around the edges. It reminds me of very lossy jpg images, but don't know what the real description should be.

Design by Trial and eror...and errror...and errorr
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 31st Mar 2009 09:57
A Duffer? Like don't know how or don't want people to see yet?

(Just curious)
--Jason

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 31st Mar 2009 13:40 Edited at: 31st Mar 2009 13:41
GeeBee

This is what I get with your sprite addition. I can't see a problem.

Just upload your image using the "Attachment" browsing feature - but make sure it's extender is in lower case, i.e. jpg not JPG etc.

Attachments

Login to view attachments
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 31st Mar 2009 15:59
GG - (how embarassing [for me] - too focussed on the "Use file Uploader applet" to consider using the "Browse..." button .

Screenshot at last - this one is with sprite activated, next post without so that you can compare from roughly the same viewpoint & perspective - to me it is even more noticeable at runtime.

Maybe its just my computer?

Design by Trial and eror...and errror...and errorr

Attachments

Login to view attachments
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 31st Mar 2009 16:00
And the screenshot with no sprite.

Design by Trial and eror...and errror...and errorr

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: 31st Mar 2009 16:58
Quote: "to me it is even more noticeable at runtime"


Unfortunately I don't see "it" at all.

I couldn't see any important differences other than the slightly different camera/light positions.
James H
17
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 31st Mar 2009 20:00 Edited at: 31st Mar 2009 20:01
Kinda looks like 16 bit colours on the terrain when the sprite is used.

Cool looking shaders as always, makes me feel like I`m in a sweetshop!
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 31st Mar 2009 23:58 Edited at: 1st Apr 2009 00:14
GG - With a bit of help from GIMP, a split screen composite from exactly the same viewpoint & capture time from my game. I have ringed the general area (in yellow), where the 'blotchy' look is most apparent, especially in the foreground.

The colours have shifted and are more, well,...blotchy. The '16 bit colour' suggestion from James H is probably a much better description.

Edit: Just checked my computer setup, and I am running at 16 bit colour as my game FPS struggles otherwise. However, when running in 32 bit, the problem is solved - no difference with or without a sprite (but FPS < 25).

Design by Trial and eror...and errror...and errorr

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: 1st Apr 2009 00:39
I can see what you mean now. Interesting.

I have no idea why adding a sprite should make a difference. Something to do with mixing 2D and 3D rendering I suppose.

But at least you seem to have found a solution.

Is it just sprites that cause the problem? What about using a correctly aligned 3D plain instead of a sprite? I can see sprites are more convenient though.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 7th Jun 2009 16:01 Edited at: 7th Jun 2009 18:53
I've noticed that some of my terrain shader demos don't work correctly with DBPro upgrade U7.4beta6 but work fine with recent earlier versions. I'll post back when I've narrowed down the cause or found a solution.

Edit

I've found the problem - DBP upgrade 7.4 has broken texture clamping when a shader is used! This means that lots of things are no longer possible with shaders.

Let's hope Lee fixes this bug.
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 21st Jun 2009 23:24
Its apparently fixed now He removed the code that broke it.


Do you know how textures are applied to advanced terrain? I'm trying to find out how but with no luck. I believe they use 2 sets of UV Data, 2 texture stages and then somehow use the 'Set blendmapping on' command to blend them together. But I have no idea what to do when it comes to that command.

New specs: Nvidia Geforce 9600GS 768MB, AMD Anthlon x64 X2 4000+ (2.6GHz Dual core), 3GB DDR2 800MHz RAM and a big hard drive.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 21st Jun 2009 23:27
Something similiar happened with the nov08 beta for darkgdk - it rendered the mesh stuff pretty much defunc.

Otherwise - gdk is slamming. I can't wait until TGC has one code base married and working nice together... should free them up a bit via simplification of the source to be maintained: I'm not saying getting the code bases merged is an easy task however.

--Jason... who needs to fix his sig LOL

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Oolite
19
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 22nd Jun 2009 03:05
I'm also getting this error.
Quote: "Subscript must be Integer or DWORD when referencing an array at line 197"

DBPro 1.073 trying to compile the Misty Fog with Terrain V3
I haven't really examined the code that much and i was wondering if someone can explain to me why this isn't compiling.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 22nd Jun 2009 15:59
from what you posted, I'd guess go to line 197, and track down the "variables" used in any subscripting of arrays to make sure they are defined early in the program as Integer or DWORD

--Jason

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Jun 2009 17:42
More likely to be my use of the line contatenation symbol "..." - the default in the old default editor. Since U7.2 I've had to change all those (but haven't updated the examples on this thread yet).
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 22nd Jun 2009 17:47 Edited at: 22nd Jun 2009 17:48
I have got the texturing to apply properly.

Please look at these steps to see if I'm doing it right


1. Create 2 sets of UVs one for texture and one for detailmap

2. Apply texture using 'Set Blend Mapping on' command with the first set of UVs, Texture stage 0 and Blend Mode 4.

2. Apply detailmap using 'Set Blend Mapping on' command with the seccond set of UVs, Texture stage 1 and Blend Mode 4.


I did that and it looks ok. but will this work with your shaders?

New specs: Nvidia Geforce 9600GS 768MB, AMD Anthlon x64 X2 4000+ (2.6GHz Dual core), 3GB DDR2 800MHz RAM and a big hard drive.
The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 22nd Jun 2009 17:58
@Kaedroho

Do you still want me to research blend mode? I need to talk to you on msn also.

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 22nd Jun 2009 18:01
The Wilderbeast,

Yes, I think it will be useful for you to research into the 'Set blend mapping on' command. I only managed to do the above through trial and error, hence why I'm seeing if it is alright to use it in the way I did.

New specs: Nvidia Geforce 9600GS 768MB, AMD Anthlon x64 X2 4000+ (2.6GHz Dual core), 3GB DDR2 800MHz RAM and a big hard drive.
Oolite
19
Years of Service
User Offline
Joined: 28th Sep 2005
Location: Middle of the West
Posted: 22nd Jun 2009 18:27 Edited at: 22nd Jun 2009 18:28
EDIT: Had this page open for a while and didn't see the other responses.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 26th Jun 2009 16:44
kaedroho

Only just seen your recent posts, sorry.

Quote: "I did that and it looks ok. but will this work with your shaders?"


I'm not sure, I'll have to check. My belief is that you either use the "set blend mapping on" command or use a shader, not both together. Generally, use of a shader will over-ride the DX9 pipeline blending stages - so I expect the answer to your question to be "no".
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 26th Jun 2009 20:08 Edited at: 26th Jun 2009 23:51
Hmm, ok. So how does Advanced Terrain do it? That doesn't use shaders. Or im guessing that your shaders apply the textures to the terrain as the direct x pipeline cant?

New specs: Nvidia Geforce 9600GS 768MB, AMD Anthlon x64 X2 4000+ (2.6GHz Dual core), 3GB DDR2 800MHz RAM and a big hard drive.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Jun 2009 00:42 Edited at: 28th Jun 2009 00:47
Quote: "So how does Advanced Terrain do it?"


I assume it uses the blending part of the pipeline. When a shader is applied to the terrain you take full responsibility for getting the blending right in the shader, either by setting pipeline states or via the vertex and pixel shader code. My shaders use the latter.

Edit

Quote: "Or im guessing that your shaders apply the textures to the terrain as the direct x pipeline cant?"


Either that or I don't know how to do it via the pipeline.

I find the shader approach more natural and quicker, whereas the pipeline solution always seems to involve hours of poring over various MS DX9 manuals instead of actually getting the job done.

Personal taste and background I suppose.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Jun 2009 13:54
Quote: "So how does Advanced Terrain do it?"


AT uses this command:
IDirect3DDevice9::SetTextureStageState

It sets the blend modes between different stages. The default is to multiply the stage 0 texture by the diffuse, but AT changes it to multiply the stage 0 texture by the stage 1 texture, and then uses the UV data to make the detail texture repeat while the colour texture stretches over the whole terrain.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Jun 2009 14:36
Diggsey,

That's a good example of what I mean.

I assume DBPro's blend mapping commands use the same function.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Aug 2009 15:41
Just occasionally, DBPro myths and legends become accepted "facts".

Well, here's one: DBPro lights don't work with Advanced Terrain (AT) objects. I've often wondered why - till this morning when I decided to delve a bit deeper.

Guess what. AT objects do work with DBPro lights after all!

All you need to do is the following:

1. Change the AT format by adding vertex normals and removing the vertex diffuse components.

2. Calculate the normals.

3. Tell DBPro that the AT object will receive lights.

And that's it. The attached very basic demo illustrates the main steps and shows the light working.

Attachments

Login to view attachments
Demon000
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location:
Posted: 25th Aug 2009 17:07
That's a nice find!
N3wton
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 15th Sep 2009 21:12
I've edited your shader for my project is that ok?

Basically I've just added fog to it...

Just checking that I'm ok to edit it and distrabute it with my program

p.s. it rocks does the shader

Yours
N3wton

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th Oct 2009 02:50
Quote: "Just checking that I'm ok to edit it and distrabute it with my program "


Yes.

Sorry for the late response - only just checked the thread.

Login to post a reply

Server time is: 2024-11-24 11:51:52
Your offset time is: 2024-11-24 11:51:52