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 / fading texture on actual mesh

Author
Message
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 12th May 2015 03:06
Is there a way to fade a texture (for example from grass to rock while getting higher) like the effect you get using a heightmap, but with actual mesh object?
I want to build a new Island using a 3d software so that i can move exactly how I want every vertex, in this way the Island will be more accurate than using a heightmap, but how can I make it to fade the texture between grass and rock?
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th May 2015 14:47
You can do it using the blend mapping commands or by using a shader. A shader gives you far more flexibility but if you only want to blend two textures then the blend mapping command works nicely - but you'll need to use the undocumented version shown in the LerpingTextures example in your Projects/Snippets folder. You'll need your heightmap to be greyscale.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 13th May 2015 00:41
I have tried to look at the snippet but is not clear at all, the 2 cubes doesnt' explain how the height will affect for example to have rock on the top of the object and grass on the base
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th May 2015 05:02
Do you mean this?

Texture Heightmap Blending

Link is this: https://www.youtube.com/results?search_query=Texture+Heightmap+Blending

Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 13th May 2015 06:44
look here:

https://www.youtube.com/watch?v=SAgEGvJKh8w

It's like there are 2 different textures but they are not applied on the Whole objects, 1 texture handle the higher part of the terrain and the other texture handles the lower part, like grass on the bottom and rock on the top, but they fade smoothly, which doesn't happend when you use 2 limbs for example and textures 1 with rock and the other with grass, squares polygons will be visible and the effect is bad, while here the 2 textures are applied to the same object depending on the height
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 13th May 2015 09:54
Actually what happens there is change of texturing according to terrain inclination. Grass for flatter, rock for steeper.
Probably a texture blending routine based on terrain profile.

Impressive but not extremely flexible for sophisticated terrains with roads, lanes and detail areas.

Not sure if this example from our excellent friend Green Gandalf could be a starting point for ideas.

Cheers
Scorpyo
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th May 2015 10:56
Here's another relevant thread from the same fellow:

blend mapped terrains





Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 13th May 2015 17:21
Looking on the last one you posted, something is not clear to me:

"set blend mapping on" command ask up to 5 variables, in your code there are 9 variables
(set blend mapping on 1, 0, 11, 10, 2, 2, -1, -1, 5)

How is this possible and what is the function of the other variables?
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th May 2015 21:40
As I said, that demo uses the undocumented version of the command which gives you greater access to the textures and states used by DirectX - and enables you to use all of the blending modes supported by DBPro.

My understanding of the blending commands used by DBPro is as follows.

The extra 4 arguments enable you to specify which of the three "surfaces" available to DirectX during a blending stage will be used and where the output will be sent. Blend mode 26, i.e. D3DTOP_LERP, requires all 3 surfaces whereas most of the modes require only two. The documented versions of the command only use two of these, D3DTA_TEXTURE and D3DTA_CURRENT but this "behind the scenes" stuff is hidden from the user.

The standard documented versions of the set blend mapping on command blend the contents of the DirectX surface D3DTA_CURRENT with the contents of the surface D3DTA_TEXTURE in some way. In DBPro D3DTA_CURRENT is initialised with the diffuse lighting at the start of blending stage 0 (DirectX9 uses 8 blending stages in sequence from stage 0 to stage 7). In subsequent stages D3DTA_CURRENT consists of the output of the previous stage. The surface D3DTA_TEXTURE corresponds to the image specified in the documented versions of the blending command.

Blend mode 26, however, requires 3 surfaces for the blending. The undocumented version enables the programmer to access a third surface, D3DTA_TEMP so the blending operation can combine 3 surfaces using a lerping operation. Lee's blending code in the LerpingTextures snippet does this by temporarily storing one of the three textures in the D3DTA_TEMP surface:



What's going on there? The blend mode is D3DTOP_SELECTARG1 which tells DirectX to use the contents of ARG1 as the stored output of that stage. The three arguments available to DirectX are specified in the next three arguments of the DBPro command, i.e. "D3DTA_TEXTURE,-1,-1" in that line of code. The two "-1"s merely indicate that the DirectX surfaces ARG2 and ARG3 are not required in that stage and ARG1 is the contents of D3DTA_TEXTURE which is the image specified in the DBPro command, i.e. image 3 (the lerping texture) in this instance. The 9th and final argument tells DirectX to put the result of the blending stage into D3DTA_TEMP instead of the default D3DTA_CURRENT.

The next line performs blending stage 1:



This is similar to stage 0 except it stores the contents of image 1 into D3DTA_CURRENT.

So at the end of stage 1 DirectX has two surfaces filled with images you need for the lerping operation.

The next stage enables you to combine these two surfaces with the third image i.e. image 2:



In that line ARG1 is specified as D3DTA_TEXTURE which in turn is specified as image 2. ARG2 is specified as D3DTA_CURRENT i.e. image 1 from the previous stage. ARG3 is specified as D3DTA_TEMP which was previously filled with the lerping texture image 3. The final argument merely tells DirectX to put the result of the blending into the usual place, i.e. D3DTA_CURRENT which is the final blended texture.

The formula used by the lerping mode 26 is (according to the DirectX SDK - see note at end ):

Quote: "D3DTOP_LERP
Linearly interpolates between the second and third source arguments by a proportion specified in the first source argument.

SRGBA = (Arg1) * Arg2 + (1- Arg1) * Arg3.
"


So, in your heightmap case the heightmap would be the lerping texture and the others would be grass and rock (or the other way round ).

Note: The DX9 documentation seems to differ from my explanation above, i.e. my explanation (and Lee's snippet) seems to suggest the formula ought to be



or perhaps ()



The blending is done per colour component, i.e. RGBA.

A little bit of experimentation might tell you what you need to know.

I've tried to find Lee's original emails where we discussed this but I can't find one where he gives the new syntax explicitly and I've gleaned the above by "reading between the lines" of our remaining correspondence.



Powered by Free Banners
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th May 2015 22:43
You might find the attached simple demo easier to digest .



Powered by Free Banners
Zero G Scott
17
Years of Service
User Offline
Joined: 14th Dec 2007
Location: California, USA, Earth, Sol Sys
Posted: 14th May 2015 12:30
Could you give more details on how a shader is more flexable? I'm just wondering what the performance differences are. Something to play with for sure! Great stuff GG.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th May 2015 15:10 Edited at: 14th May 2015 15:16
In a shader you can do all sorts of calculations very easily - if you can do the maths then you can do it in a shader: texture blending with several textures, specular highlights, fog, several lights, emissive effects, bump mapping and so on. The standard pipeline blending modes are a straightjacket by comparison - and you quickly use up the 8 blending stages available.

This discussion has prompted me to dust off an old bump mapping demo of mine (see comment below) using blending modes - see separate thread.

Comment I think the basic idea for bump mapping via blend mapping was written by someone else on this forum but I've now lost the details. If I find out I'll add the credit to the demo.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 14th May 2015 19:17
I didn't make any test yet, but I will today or Tomorrow, by the way will I be able to use also a normal map shader on the terrain? I use the evolved normal map shader so I have light data directly on the shader and change the values when required using set constant effect command (or something like that I don't remember).
The problem is also I never managed to apply 2 effects to the same object, for example if I apply a tree shader for the movement of a tree I cannot apply a normal map shader to it (it will removes the tree shader using for the movement of the tree)
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th May 2015 19:32
Quote: "The problem is also I never managed to apply 2 effects to the same object"


That is correct. You need to combine the code from the two shaders into a single shader. Similarly you cannot use a shader and the blend mapping commands at the same time. You'd need to add code to the shader which does the blanding for you.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 14th May 2015 19:49
Damn so if I use the blend shader to make the terrain looks better I cannot use a normal map, that will looks bad.
Do you know any shader that do blending and normal maps?
Zero G Scott
17
Years of Service
User Offline
Joined: 14th Dec 2007
Location: California, USA, Earth, Sol Sys
Posted: 14th May 2015 19:52
Are the stages in set blend mapping on related to the stage settings for Texture Object and Set Object Texture? I was referencing those yesterday and it wasn't quite so clear how to use the stages. Thanks for the bump mapping example, helps to see a different way of using things.

I'm assuming also then that using shaders is how to transfer some of the game processing to the GPU and move it from the CPU, though that's probably a simplification on my part.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th May 2015 20:16
Quote: "Do you know any shader that do blending and normal maps?"


I'm glad you asked that. Have a look at these:

Shaders for Advanced Terrain

Some of the demos might need tweaking because of changes to DBPro but one of those should be close to what you want.



Powered by Free Banners
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 14th May 2015 21:01
Hey GG..
Any idea why I get this error (see pic)
Cheers
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th May 2015 21:14
Almost certainly means you haven't got IanM's Matrix1 utilities installed. If you don't want to install them then just write a function of your own to calculate the minimum of two numbers.

My advice though is install them. They are indispensable.



Powered by Free Banners
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 14th May 2015 21:43
Cool
Thanks a lot
Cheers
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 15th May 2015 22:44
Ok gandalf, I have tried your example, this one:

http://forum.thegamecreators.com/?m=forum_view&t=135070&b=8

It works, but I don't like how the light is handled, it makes the normal maps almost useless.

If you check the evolved normal and relief map shaders, they have some variables to tweak that let you make a very realisic light source, these are the ones he has:

float3 Ambient
float3 LightPosition
float3 LightColor
float LightRange
float SpecularPow

In particular specularPow it's very usefull to make a light source that will "fade" on the point you are looking to, to make it a very cool smooth effect, instead of having just a directional light that will illuminate almost the same every part of the ground for example.

If this can't be fixed I think I am gonna stick with making a mesh terrain and apply to it a normal map shader, in that case would be usefull find a shader that do both blend mapping and normal mapping, maybe someone managed to edit the one of evolved?
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th May 2015 01:14
Quote: "Ok gandalf, I have tried your example, this one:"


Which example? There are several on that thread.

Quote: "It works, but I don't like how the light is handled, it makes the normal maps almost useless."


If you mean the one used for the first screenshot on that thread then I have no idea what you mean - the normal maps have a big effect in that case.

For terrains the usual light source would be a sun or moon - and there is no point at all using a positional light for those.

Quote: "In particular specularPow it's very usefull to make a light source that will "fade" on the point you are looking to, to make it a very cool smooth effect, instead of having just a directional light that will illuminate almost the same every part of the ground for example."


You seem to have confused at least two quite different things in that sentence. It is true that my terrain shader does not include specular reflection as that is often unnecessary for rough terrain. You could try adding it yourself of course to simulate the effects of rain on the ground for example. Directional lights can have specular highlights - specular reflection is a physical property of the surface and nothing to do with whether your light is positional or directional. A directional light will not illuminate all parts of the ground the same - just look at the first screenshot on that thread for example. Are you talking about ambient light perhaps? Either way, I do not understand what you are talking about.

Quote: "If this can't be fixed"


What is "this" exactly?

You ask for a shader that does both blending and normal mapping and I've pointed you to one. The only thing I can see you might want to add to that is specular reflection which could be done of course (might need PS3 because of instruction count limits). Perhaps you didn't try the normal mapping option when you ran the demo?



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th May 2015 01:34
Yes I meant the 1st terrain on that thread, I have used normal maps, the first 4 stages are diffuse textures while the other 4 stages are for the normal maps, it is a bit better than without any normalmap but the effect is not the same as the one you can get with the evolved normal map.
I know that even with your example not all parts are illuminated the same, but the illumination is not good as the evolved shader, because of the specular option which makes everything look cooler
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th May 2015 01:58
Well, you have a choice: either add specular reflection to mine or add blending to Evolved's. If you study the code I'm sure you can do either.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th May 2015 02:48 Edited at: 16th May 2015 03:38
My skills with shaders are equals to zero, Learning a Language it's never a 1 day or week thing, sadly at the moment I am too busy with a lot of things so I can't study that Language, that will eat up the time I am using to push forward my game, I don't want to release it in 2020, my goal was this summer and I am doing my best to finish the Alpha for this summer, for the moment I am trying to make a mesh terrain and see how it goes, hope will looks good enough

Edit:

mmm I am actually having troubles with the mesh, dividing it in 2 and texturing rocks above and grass below it really looks awful because you see where the polygons ends, maybe I ll try the heightmap option but is so sad to lose the specular illumination
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th May 2015 06:56
I think I am going to give it a try to your shader, but I have a problem, I don't know how to deal with the light direction, I am used to set a light position in other shaders so I don't know how to deal with the floats in the light direction, any help?
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 16th May 2015 11:30
I think you should look at Blitzwerks Terrain... I think there is a free version on the forum...

Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 16th May 2015 12:30
Quote: "mmm I am actually having troubles with the mesh, dividing it in 2 and texturing rocks above and grass below it really looks awful because you see where the polygons ends, maybe I ll try the heightmap option but is so sad to lose the specular illumination"


You can achieve that by using transient Tiles (see attached pics - very basic stuff tho)

But..
It is very paintasking achieveng good Tiles quality and extremely painful and time consuming to apply them to the mesh, especially in case of complex , wide terrains.
But if you don't mind going mental, you could give it a try.

Cheers
Scorpyo
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 16th May 2015 14:09
Does Blitzwerks Terrain support blending and normal map with specular light? Also will be easier to have a "light position" variable instead of a directional light, as I don't know how to use it, and the relief and normal map I use from evolved are setup with light position so would be easier match exactly the light the same.

About Transient Tiles, how can I do that?
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th May 2015 14:17
Quote: "I think I am going to give it a try to your shader, but I have a problem, I don't know how to deal with the light direction, I am used to set a light position in other shaders so I don't know how to deal with the floats in the light direction, any help?"


A simple way is to imagine the light being a long way away from your world and construct the light direction from that. For example, suppose your sun is at world position XYZ = (Sx, Sy, Sz) and your scene is at XYZ = (Wx, Wy, Wz). Then you can calculate the light direction as used in my shader as follows (using your own numbers of course):



That's it.

You can either do that once before your main loop or inside the loop if you want to move the sun (in that case you'll still want the make vector command before the loop).



Powered by Free Banners
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th May 2015 21:30
I ve taken a look at the Blizweks terrain pdf and I didn't see any command usefull to make a specular lighting on the terrain
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th May 2015 21:54
I'm not surprised. Terrains usually look odd with specular lighting - exceptions might be wet rock or ice. Broad leaved forests of shiny evergreen trees such as rhododendrons might want specular reflections but most landscapes wouldn't want it.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th May 2015 22:01
The same Terrain I use made as object looks cooler appling a normalmap that use specular lighting, even if the lights is applied to plain grass
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 18th May 2015 03:17
Just apply a specular map to it? use texture stages I think...

Last page of the manual has BLEND MODES listed...

Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th May 2015 04:57
I see the blend modes, but there is no specular thing there.

Also how can I add a specular map?
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 18th May 2015 05:14
No idea... Hunt down the dev...

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th May 2015 10:27
I've never gotten good results from automatic shader transitions, shader normal mapping or terrain modelling.

What is giving good results is that crusty old GreenGandalf terrain colourmap shader and some random generation. I generate a terrain then 2 index images for 6 different terrain textures, lots of mud, grass, rocky bits. By using index images you can take more control over texturing, blend more, add random details and more dynamic slopes. It's also possible to reduce the textures to 5, and have a colour map as well, which might be good for lighting - all the terrain lighting and shading could be calculated on a colour map. The index images are created using image memblocks, but this also gives access to this data with code - so you could check a terrain location to see how dark it is, or which textures are used - I found this invaluable for adding a foliage effect, I can check how much grass is at a specific location and colour it to suit the calculated lighting levels.

The instant you introduce the requirement for normal mapping, things get a bit desperate. I mean 6 textures on a terrain gives nice results, it's easy to break up repetitive areas and things can blend well and give an organic look. Because we are limited to 8 textures on a terrain, that means you could have 4 different textures with normal maps, but not specular map so the effect is somewhat nerfed. If you need individual specular maps then you can have 2 different textures, not enough to do anything really.

If you really need normal maps on a terrain then I would suggest doubling those terrain meshes, and have 1 terrain with the diffuse textures, and another terrain with the normal map textures, then you could use the index shader and 6 textures. It would of course put an extra burdon on performance - but really when you see DBPro running on a modern PC, it doesn't struggle, it might be completely fine to do it that way.

I guess it depends on how big a project this is, do you want to spend the time on the terrain, how are you planning on designing terrains, how many textures do you need, what sort of view distance etc etc.

Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th May 2015 10:42
Actually 2 textures could be fine for me, grass for the ground, and rock for the hills/mountains, it's not a huge and varied landscape actually, because I don't make 1 unique place, but different Island where to travel, so they have a medium size.
Using the normal map or relief map from evolved gives a cool specular light effect, the only problem is that is not realistic have Hills and mountains with a grass texture, the same as the ground, so even 2 textures 1 for the grass and 1 for the mountains could be ok, if I could use a specular light as well.
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th May 2015 13:12 Edited at: 18th May 2015 13:15
Quote: "Actually 2 textures could be fine for me, grass for the ground, and rock for the hills/mountains"


Actually that's 4 if you include the normal maps. The problem with that is that you tend to get a noticeable boundary at a fixed height even if it's softened by blending.

Do you need the specular lighting to react to the detailed normal provided by the normal maps, or will it suffice to use the terrain's normal? The latter should be simple to add to the terrain blending shaders.

I think VanB needs to post the shader he's talking about - for my benefit as much as anyone else.

Edit Also, Cescano, could you provide a screenshot showing the kind of specular effect you are trying to achieve? In fact this whole discussion would benefit from a few screenshots from everyone.



Powered by Free Banners
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th May 2015 13:26 Edited at: 18th May 2015 13:29
I plan to make a normal direction shader which might just do the trick. What that does is takes the polygon normal, and uses that to decide which texture to use. So you could say, positive Y normals mean grass, otherwise a default rock texture is used. It would also use the world position to calculate the UV coordinate, instead of the mesh.
Typically a terrain shader with automatic slope texturing would just work out the angle or rate of incline and go from there - but this shader would work differently. Really, you could take any mesh, any shape, even tunnels or caves in a modelled island, and it'll automatically texture it and it'd automatically blend together. Even if you just throw things together to make the island it'll still texture nicely. It will rely on things being terrain-like, so much better to have sloped walls than straight, because it will use the world position to texture, vertical walls will look the worst.

I want to use this to make elaborate rocks, with 3 textures (one for each axis), and these textures will blend together depending on the normals, so I can take a few different rock meshes and have them look like 1 large seamless structure. Once I have it done I'll send you a test program, I think it might be the easiest way to go, as it also removes the need to UV map the terrain... you would just swap out the top rock texture for grass. Maybe have the shader use a sand texture when below a set height.

So, from the 8 available textures, I'd suggest
Grass diffuse
Grass normal map
Rock diffuse
Rock normal map
Rock specular map
Sand diffuse
Sand normal map
Sand specular map

I'd just use the grass diffuse texture for specular highlights, as there's not a lot you can do with grass specular anyway - specific specular maps are better for shiny rocks, wet sand etc.

To hell with it - I'm making an island shader demo, I need to learn shaders better anyway.


GG, I'm sure you'll remember that shader... I used it in Tersculpt, you made it before making versions with automatic slope texturing. Ok we might be going back 10 years - I'd post it up, but without all the code to generate the textures and terrain it's kinda pointless, and I can't share too much of that stuff as its a live project.

Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th May 2015 13:49
Quote: "To hell with it - I'm making an island shader demo, I need to learn shaders better anyway."


Yes please.

Here are a few screenshots using some demo terrain shaders of mine.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 18th May 2015 19:34 Edited at: 18th May 2015 19:34
This is what I mean (attachment)

1 is the heigthmap terrain blended with gandalf shader (8 stages used)

the other one is a normal object that is the same terrain shape, but applied with evolved relief map shader (3 stages used)

You may think I am crazy of using a relief map for the terrain but I think it looks cooler that with normal map.

In the one with the evolved shader you can see the "specular light", it's like a specular reflection you see for example facing the moon on the seaside, if you move you still have the reflection in front of you, and the same happens on the ground both with sun or moon, obviously is less noticeable than in the water but the effect is realistic compared to a flat illumination.


Edit: So basicly I need the specular light more on the ground that on the rocks
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th May 2015 00:29
Thanks for those. Your heightmap blended shader image looks very dark and flat as if you haven't used the normal mapping technique. Which technique did you use?



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 19th May 2015 00:35
I have used your shader like in your example, first 4 stages for the textures, the other 4 stages for the normals, then applied the shader, but I have modified your shader reducing light and ambient light, as I need to make a dark scene with this island
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th May 2015 00:39
But which technique did you use? That shader has two. The default one doesn't use normal mapping.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 19th May 2015 00:47
I use "set object normals 1", if that is what you mean, I am not using the function at the end of the code
Green Gandalf
VIP Member
20
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th May 2015 01:22
No. I mean which technique in the shader, "t0" or "t1"? You need to use "t1" for normal mapping as in the demo:



If you haven't done that you're not using normal mapping.



Powered by Free Banners
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 19th May 2015 01:32
damn I miss that part, now is looking better, although will be even better with specular lighting

I have seen in a recent post of Stab, where he mention the Advanced lighting, that the terrain demo of evolved has that specular lighting and in fact it looks cool! (more visible on the beach i think)
Maybe there is already a shader done for me in his example?
Cescano
10
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 25th May 2015 07:43
Gandalf, a question, let's say I want to add a campfire on the terrain, I have already the fire animation etc, the only problem is that if I make a new light and add it on the terrain (maybe 100 units above the campfire), the terrain is not affected at all by the light I have made, why is that? and how can I add a light to make the campfire more realistic?

Login to post a reply

Server time is: 2025-08-09 02:29:35
Your offset time is: 2025-08-09 02:29:35