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
Mr Bigger
19
Years of Service
User Offline
Joined: 31st Jan 2005
Location: was here!
Posted: 31st Oct 2008 01:10
Your shaders look fantastic.Thank's for all your hard work and help you give everyone.Your a real inspiration.

AMD 2600+/1GB ram/GeForce 6600oc 256MB/W2KPro/DBPro 6.6.b
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 8th Dec 2008 14:46
GG - Batvink pointed me in your direction.

Before I disappear into the potential rabbit hole of "learning about shaders", would your shaders be able to provide the effect I enquired about at the link below (Summary: flare to light AT beneath it)?

http://forum.thegamecreators.com/?m=forum_view&t=141065&b=7

Alternative solutions also readily considered !!

Design by Trial and eror...and errror...and errorr
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th Dec 2008 19:25
Quote: "would your shaders be able to provide the effect I enquired about at the link below "


With a little bit of modification, yes.

Actually, a lightmapping solution would be simplest - unless you want the light to move around the terrain in some way (but even that might be fixable).

It's now the latest suggestion on my list of things to do.
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 10th Dec 2008 09:15
Quote: "unless you want the light to move around the terrain in some way"


I do - the intent is to represent a parachute flare, that will drift according to the wind conditions, while also descending, thus reducing the area of light coverage.

Many thanks for your speedy (+ heartening) reply - I will also add to my list of things to do "learn about shaders" !!

Design by Trial and eror...and errror...and errorr
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Dec 2008 19:48 Edited at: 12th Dec 2008 19:52
Quote: "I'm updating my old shader demos for Advanced Terrain and hoping to add new ones."


The latest DBP upgrade has forced me to have another look at my updated demos and 1 or 2 of them will need updating again - and 1 or 2 need some tidying up (one was posted before I'd cleaned out all my experimental non-functioning code - careless ).

I've also taken the opportunity to resurrect a self-shadowing terrain shader and will be posting that here soon.

I'll be posting the revised demos as soon as the latest DBP upgrade is finalised, hopefully over the next few days.

GeeBee

Your idea sounds interesting. How many of your flares would you have on screen simultaneously? One or two should be OK depending on your machine's spec, but much more than that could cause problems.

Why is my list of things to do suddenly getting longer?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Dec 2008 00:06 Edited at: 13th Dec 2008 00:13
Here's a screenshot of the latest version of the self-shadowing Advanced Terrain shader. It's been tested with the latest upgrade (U71BETA11). It will be edited again when the new upgrade is finalised.

The demo illustrates the use of the new flag value for the load image command which allows you to load a volume texture. In this case the volume texture is used to store a pre-calculated "horizon map" which enables the shader to calculate the shadows quickly. [Remember my machine is slow and old. ] To use this shader on your own terrain you'd need to be very nice to someone who could calculate the horizon map for you.

The demo download is in the next post.

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: 13th Dec 2008 00:08 Edited at: 21st Dec 2008 12:24
And here's the download.

Edit Corrected dba code to both calculate light altitude angle correctly and to apply it. Also added relevant useful screen info. [Thanks due to Jeff Miller (20 Dec 08) who spotted the problem. ]

Edit 2 Added Jeff Miller's follow-up suggestion.

The self-shadowing becomes clearer when you reduce the Y altitude angle to about 20 or 30 degrees (90 means the light is pointing straight down, 0 means the light direction is horizontal (very long shadows).

Attachments

Login to view attachments
draknir_
18
Years of Service
User Offline
Joined: 19th Oct 2006
Location: Netherlands
Posted: 13th Dec 2008 01:28
Stunning work as usual GG. I'm averaging 90 fps with a Geforce 8400.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Dec 2008 14:31 Edited at: 13th Dec 2008 14:32
Thanks!

By the way, did you get your normals sorted out on the following thread?

calculating normals query

My final post could have been a bit more helpful.
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 13th Dec 2008 15:00 Edited at: 13th Dec 2008 15:01
Will this work with my LOD terrain system? Im making it a dll and im going to have to add support for these shaders (so there is no disadvantage of using my terrain engine instead of Advanced Terrain).

My lod terrain system uses indexbuffered triangle lists (which is what AT also uses)

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Dec 2008 18:34
Quote: "Will this work with my LOD terrain system?"


By "this" I assume you mean the self-shadowing shader.

The shader assumes that the object has XYZ, NORMALs, UV0 and UV1 coords - and that you've got a horizon map handy. There is very little else that is specific to Advanced Terrain in the demo.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Dec 2008 18:37
GeeBee

Is the attached demo what you are after?

The demo shows three techniques:

1. directional light (e.g. the sun)
2. positional light (e.g. your flare)
3. both the above.

Screenshot in next post.

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: 13th Dec 2008 18:38 Edited at: 13th Dec 2008 18:39
Screenshot for light flare demo:

Attachments

Login to view attachments
draknir_
18
Years of Service
User Offline
Joined: 19th Oct 2006
Location: Netherlands
Posted: 13th Dec 2008 21:23
Quote: "Thanks!

By the way, did you get your normals sorted out on the following thread?

calculating normals query

My final post could have been a bit more helpful. "


Unfortunately I didn't get it sorted out, but don't worry about it! I was in crunch mode when I posted that and what I wanted was a quick fix, but I realized that to do it right I'd have to spend time I just didn't have, so I just left it out.
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 13th Dec 2008 22:16
Quote: "The shader assumes that the object has XYZ, NORMALs, UV0 and UV1 coords - and that you've got a horizon map handy. There is very little else that is specific to Advanced Terrain in the demo."


My terrain engine uses only 1 texture (detailmap) and sets the diffuse colour for the texture.

Im gonna try to get as many of your shaders as possible to work with my engine and thanks for the info

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Dec 2008 00:02 Edited at: 14th Dec 2008 00:04
Quote: "My terrain engine uses only 1 texture (detailmap) and sets the diffuse colour for the texture"


That's easy to fix.

Does your object have normals? If not you can either add them - or just ignore the diffuse aspect of the lighting altogether and just make do with the soft shadows created using the horizon map. Or you could use a special purpose normal map as I did in one of my early demos on this thread.

Quote: "Im gonna try to get as many of your shaders as possible to work with my engine"


This is probably the best place for any terrain shader queries you might have - even if your models aren't Advanced Terrain. There's not a big difference really.
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 14th Dec 2008 00:21
Quote: "Does your object have normals?"


Yes


Quote: "This is probably the best place for any terrain shader queries you might have - even if your models aren't Advanced Terrain. There's not a big difference really."


Ill attempt to apply some, if they dont work, then ill post on here.

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 14th Dec 2008 10:27
GG - I've been looking at LeadWerks 2.? engine a bit today... and I wanted a tutorial on how his shaders are set up... modular is the best way to summarize it...

He has one shader kinda.. with "if logic" to pull in and include other "mini" shader snippets into one big shader... so one can combine scene things .. like bloom etc.

I wonder if your (growing massive) list of shaders could be such arranged in a DBPro/GDK flavor so combinations of your shaders would be easier to implement for bigger projects? I'd bet many wouldn't mind dropping a dime or two on a package like that...

just a thought - its just you do such good work
--Jason

GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 14th Dec 2008 17:15
Quote: "Is the attached demo what you are after?"


Yes ! I'm amazed (and grateful) at your speed of response. I will get back to you once I've looked at it in greater detail.

As you indicated in a previous post, I will have to consider carefully how to handle multiple flares, for which I have a few ideas.

Design by Trial and eror...and errror...and errorr
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Dec 2008 18:36
jason p sage

Quote: "I wonder if your (growing massive) list of shaders could be such arranged in a DBPro/GDK flavor so combinations of your shaders would be easier to implement for bigger projects? I'd bet many wouldn't mind dropping a dime or two on a package like that..."


Food for thought.
pdq
18
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 16th Dec 2008 03:00 Edited at: 16th Dec 2008 03:01
Hi GG.

Are you going to combine your AT Bumpmapped Shader with your AT Misty Shader?

I like both shaders and I am trying to figure out a way to add fog to your AT Bumpmapped shader.

--PDQ
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Dec 2008 11:44
Quote: "Are you going to combine your AT Bumpmapped Shader with your AT Misty Shader?"


I'm sure it can be done.

If I recall correctly the only reason I didn't do it in the demo was the likely poor performance on my old PC. The demo does have the misty fog AND bumpmapping applied to the stone pillars - it should be easy to include for the terrain object as well (unless there's some obscure pitfall I've forgotten like instruction count ).
pdq
18
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 19th Dec 2008 22:57 Edited at: 19th Dec 2008 22:57
Hi GG.

I tried adding the following fog command to your bumped terrain vertex shader:



But it does not seem to work correctly. It is like the entire terrain is fogged regardless of the EyePosition.

Any ideas as to how to do basic fog in your shader?

THX
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Dec 2008 00:01
Something like that should work - with the necessary changes elsewhere in the shader. Could you post the whole shader with your edits so I can test it?
Jeff Miller
19
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 20th Dec 2008 02:23
On the self-shadowing demo, I altered the code to crank the resolution up to 1920 x 1200 x 32 and it still runs very fast even at that higher resolution - 85 fps at the default camera position and much higher when the camera position is altered to view more of the skybox. It also looks really good.

When I increment the value of the "light angle altitude" with the "a" keypress I can't perceive an effect (which does not mean that there isn't any) other than a change in the displayed value. What is the intended effect of changing this value?
pdq
18
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 20th Dec 2008 04:05
To GG:

Here is your shader with the fog code added:



THX
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Dec 2008 15:57
Jeff Miller

Quote: "When I increment the value of the "light angle altitude" with the "a" keypress I can't perceive an effect (which does not mean that there isn't any) other than a change in the displayed value. What is the intended effect of changing this value?"


Well spotted Jeff. I've amended the download to deal with that correctly - and to add a bit of extra screen info. Looks like I didn't finish the dba code properly - it was using a fixed value that I had used when I was testing the shader.

Hopefully it's OK now - and thanks for the feedback.

pdq

Thanks. I'll have a look and report back later today.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Dec 2008 17:39 Edited at: 20th Dec 2008 17:41
pdq

Quote: "But it does not seem to work correctly. It is like the entire terrain is fogged regardless of the EyePosition."


I couldn't reproduce your problem - see attached screenshot using red fog (to make the fog really obvious )and bumpmapping:



Actually, although your shader works, I think your render states should have been set as follows in the techniques section:

Attachments

Login to view attachments
pdq
18
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 20th Dec 2008 23:38
Hi GG.

I found the problem. I re-positioned the terrain, so that the center of the terrain is at position 0,0. By doing that it messes up the fog.

Thanks
Jeff Miller
19
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 21st Dec 2008 00:58 Edited at: 21st Dec 2008 01:06
Thanks for the light altitude angle fix on the self-shadowing terrain shader.

On the azimuth angle you are now also displaying, I would suggest adding "angle# = wrapvalue(angle#)" after the command that increments it at line 149. The shader doesn't care, but it makes the displayed value wrap and look more familiar.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Dec 2008 01:33 Edited at: 21st Dec 2008 12:25
Quote: "On the azimuth angle you are now also displaying, I would suggest adding "angle# = wrapvalue(angle#)" after the command that increments it at line 149. The shader doesn't care, but it makes the displayed value wrap and look more familiar. "


Good point.

Don't know why I didn't do that before.

Edit Amended the demo again.
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 29th Jan 2009 19:33
GG - Ive just finally sorted out my pc and tried these...

Bloody Amazing !!

Siddy
15
Years of Service
User Offline
Joined: 16th Dec 2008
Location:
Posted: 10th Feb 2009 09:05
I tried the demo.

Why do i get "Script must be integer or DWORD when referencing an array at line 136" In the DBPro vr, and "unrecognised parameter at line 23" in DB?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Feb 2009 20:39
Quote: "Why do i get "Script must be integer or DWORD when referencing an array at line 136" In the DBPro vr, and "unrecognised parameter at line 23" in DB? "


No idea.

Which demo are you trying to use? There are several on this thread.

Which DBPro upgrade are you using?

Some demos use IanM's plugins.

Some demos use ... as the line concatenation symbol (as in the old default DBPro editor).
Siddy
15
Years of Service
User Offline
Joined: 16th Dec 2008
Location:
Posted: 15th Feb 2009 07:46 Edited at: 15th Feb 2009 08:02
I tried all the demos, they dont work without:
http://forum.thegamecreators.com/?m=forum_view&b=18&t=85209&p=0

Now they work great!
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 15th Feb 2009 14:48 Edited at: 15th Feb 2009 14:49
The Blend shader works fine with my terrain engine with no probs at all.

Ive posted the test program. Find it at the bottom of the first post in the following link:

http://forum.thegamecreators.com/?m=forum_view&t=141594&b=1&p=0

I got twice the FPS with my terrain engine than I got with Advanced Terrain.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Feb 2009 22:14 Edited at: 15th Feb 2009 22:24
Quote: "I got twice the FPS with my terrain engine than I got with Advanced Terrain."


Interesting. Any idea why?

Edit The LOD idea I suppose?
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 17th Mar 2009 22:57
GG - earlier in this thread you 'tweaked' your AT shader to enable a 'flare' effect (GGATLightFlare.fx).

Assuming I understand the effect options correctly, I can only adjust the colours (dirCol/posCol etc) to emulate a night view. This is making it difficult to achieve varying levels of darkness and can causing the terrain texture to look odd (screenshot for info).

Is it possible to add in a user adjustable "ambient light" option?

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: 18th Mar 2009 13:05
Quote: "Assuming I understand the effect options correctly, I can only adjust the colours (dirCol/posCol etc) to emulate a night view. This is making it difficult to achieve varying levels of darkness and can causing the terrain texture to look odd (screenshot for info)."


Not sure I understand the problem. If we're talking about the same shader then it already has user adjustable options for the colours of each of the three lights: the ambient light, the directional light and the positional light (the "flare"). It's the DBPro demo program that doesn't use them. Here's the relevant bit of the shader:



All you need to do is change the values of these in the usual way using the DBPro commands set effect constant vector and set effect constant float as appropriate. The values specified in the shader are just default values.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 18th Mar 2009 22:55 Edited at: 18th Mar 2009 22:55
Hey GG I just wanted to tell you that your terrain shader looks excellent . I'm using the first bump blend shader you introduced in this game here:
http://forum.thegamecreators.com/?m=forum_view&t=147310&b=8

I've given you credit in the post and if I add an actual credits section to the game you'll recieve credit there too

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Mar 2009 00:38
Thanks.

Just seen your demo - looks impressive.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 19th Mar 2009 02:27
Thanks .

GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 19th Mar 2009 16:13
GG - The problem I have is not your shader (obviously perfect!!) but my ability to align the shader settings (which affect the AT)with the ambient light setting I am using (which affects the other objects. This is to create various degrees of 'darkness' representing for eg 'Full Moonlight', 'Half Moonlight' and 'Ouch-what-was-that'....

Your earlier response made me realise I hadn't quite been manipulating the shader values 100% correctly , so I will retry.

However, a logical follow on question is whether there is a direct 'correlation' I could use between DBPro Ambient light setting (described as a percentage) and a suitable effect(s) setting? Or should I simply be applying the shader to all the objects as well (would it work?)? Or any other solution?

Any response is welcome, even if it confounds or embarasses me (or both....

Design by Trial and eror...and errror...and errorr
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Mar 2009 14:28
Quote: "The problem I have is not your shader (obviously perfect!!) but my ability to align the shader settings "


Ah I see. It isn't perfect by the way.

Quote: "However, a logical follow on question is whether there is a direct 'correlation' I could use between DBPro Ambient light setting (described as a percentage) and a suitable effect(s) setting? Or should I simply be applying the shader to all the objects as well (would it work?)? Or any other solution?"


The short answer is that I'm not sure. The built-in DBPro lighting doesn't always behave the way I expect - probably because the DBPro Help files don't explain precisely what is done. So I tend to use shaders for everything which is probably wasteful - but they do give you near total control.

I'd try a bit of experimenting. Colour components in shaders range from 0 to 1, but in DBPro they range from 0 to 255. Commands such as set ambient light are probably used to apply a percentage of the colour set in the color ambient light command.

My guess (and it is a guess because I haven't tested this carefully) is that the following DBPro commands:



are equivalent to setting the ambient light to rgb(150, 150, 0) i.e. mid yellow. This is equivalent to setting the ambientCol components required by the shader to 150.0/256.0, 150.0/256.0, 0.0, 1.0, i.e. 0.5859375, 0.5859375, 0.0, 1.0. Actually I'm not sure whether the RGB values are scaled by 256 or 255 - one of those picky details that I'll check one day.

You could test this by writing a simple shader which just applies ambient light to a sphere - and compare this alongside another sphere which just has DBPro ambient light applied to it (but you'll have to make sure it's not getting any other sources of light).

Quote: "Any response is welcome, even if it confounds or embarasses me (or both...."


And possibly both of us too.
Krisper
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 25th Mar 2009 07:40
I am a big fan of your shaders GG. I have just started back on my own project trying to get a nice terrain with a day/night cycle etc. But I am not very experienced at coding so I am struggling. I have downloaded just about all of your demos and notice you have lots of different ones doing different combinations of things. I have only just seen your fog one which is fantastic. I was wondering how far you can take it with a combination of shaders, ie blended terrain textures, fog, shadows, light flares etc.

I made some attempts a while ago and have attached a copy. It is a combination of your code and someone else's code to make the sun flares. I forgot who did that code, my apologies to whoever that was. Plus I modified some of it. It was getting closer to what I want but I'd love to add fog etc to it. Have you considered putting a whole package together? I'd pay money for a good package. I was hoping that Wilderbeast was going to finish his Dark Environment plugin http://forum.thegamecreators.com/?m=forum_view&t=127682&b=1 but that looks like it might not happen.

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 Mar 2009 12:43 Edited at: 25th Mar 2009 13:12
Quote: "I was wondering how far you can take it with a combination of shaders, ie blended terrain textures, fog, shadows, light flares etc."


Yes, I'm wondering too.

There are a number of hardware/software limitations to get around. The obvious one is performance - several of those demos run very slowly on my machine which is ancient, but they work fine on modern machines with decent graphics cards.

Another more irritating limitation is the number of textures that can be passed to the shader. I seem to be limited to eight - but I'm not sure whether that is a DX9 limit, a PS2 limit, a DBPro limit or something else. Eight might sound a lot - but my terrain blending demo with bump mapping uses all eight which means I can't easily add roads via other textures. I might be able to get around that limitation by using a sequence of full-screen shaders - but I've tended to avoid that option because of the performance hit.

Anyway, I hope some time soon to have both a new machine and more time so I'll be putting together a collection of shader demos and tutorials. I will probably throw in some utilities that I've written for various purposes as well.

Quote: "I'd pay money for a good package."


Food for thought.

And thanks for the encouragement.


Edit Just tested your demo. Very nice.

I liked the lens flares - I'll have to study the code to see how you did that.
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 29th Mar 2009 20:37
GG - short update, two discoveries.

1. It seems the shader ONLY works fully with a 256x256 heightmap - is this what you would expect?. I was using a 64x64 heightmap which didn't seem to apply any directional light effect.

2. The shader doesn't like sprites - it creates a 'blotchy' effect as soon as one is used.

I am still tinkering with the settings in order to resolve my earlier enquiry, but I'm hoping the above may assist due to the improved 'visuals' I can now achieve at runtime.

Design by Trial and eror...and errror...and errorr
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 30th Mar 2009 00:45 Edited at: 30th Mar 2009 01:26
Quote: "It seems the shader ONLY works fully with a 256x256 heightmap - is this what you would expect?."


No.

I'll do some testing and post back.

Edit The shader is not the problem.

The problem is that the AT commands use the pixel dimensions of the heightmap to determine the overall size of the terrain and the number of polygons used to construct the terrain. So when you used a 64x64 heightmap all my calculations of the terrain's scale, the terrain's normals, etc, get screwed up.

I doubt I'll bother to fix this since the solution is obvious - use a 256x256 heightmap. But you never know, I might.

The best solution would be to ask TGC to remove this rather annoying feature. Why should the size of the image affect the poly structure of the terrain? Seems daft to me.

Edit2 I tell a lie - it doesn't affect the normals, only the terrain's scale which is easy to fix. For your 64x64 heightmap you need to change this:



to this:



More generally, if your heightmap is WxW pixels in size then the terrain scale needs to be changed to:



You'll need to supply a value for W.

I've tested that using W = 64 and W = 512.

Let me know how you get on.
GeeBee
16
Years of Service
User Offline
Joined: 26th Aug 2008
Location:
Posted: 30th Mar 2009 23:57
GG - thanks.

Ref my comment "doesn't like sprites" - nor does it like "paste image". Both result in the same blotchy look.

I can avoid using "Paste Image" and am moving my sprites (buttons)over to locked-on objects. More coding...(sigh)...

However, I am increasingly confident this will allow me to achieve the lighting I am after, so it's all movement in the right direction.

Design by Trial and eror...and errror...and errorr
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 02:31
Quote: "Ref my comment "doesn't like sprites" - nor does it like "paste image". Both result in the same blotchy look."


I don't know what you mean. What are you doing precisely? And what is this "blotchy look"?

Quote: "However, I am increasingly confident this will allow me to achieve the lighting I am after, so it's all movement in the right direction."


Sounds like it.

Login to post a reply

Server time is: 2024-11-24 14:32:20
Your offset time is: 2024-11-24 14:32:20