C4 Engine

Facebook Twitter Google+ YouTube IndieDB
News Explore
Download Demo
Feature List
Licensing Info
Screenshots
Video
Support
Support Forums
C4 Engine Wiki
API Documentation
Release Notes
Purchase My Account

Terrain Texture Detail

Topics about the art pipeline and external content creation.
Forum rules
Advertisements for products and services are not allowed unless you are a licensed user of C4 and you have been given permission to post them.

Terrain Texture Detail

Postby dwalther2 » 18 Jun 2009, 10:00

Ok, this is driving me really crazy. As I am one to check tutorials, the wiki, and doing searches on the forum before I ask questions, this has me stuck. I have created a terrain and imported it. I have applied the texture and it looks good except up close. I understand the concept of the terrain pallette but I'm still not getting it. Why does the "up close" look washed out but the distance is fine ? I am from the Torque camp originally and all we had to do is add a detail texture to get the effect I'm looking for. So, obviously, I'm not understanding what has to be done in the C4 engine. :cry: Although, I have seen some of the forum posts on this subject, none of them has really spelled out what needs to be done. Does it maybe have something to do with the shader editor? I am using a 1024 heightmap with 2048 texture in the pic. I have tried several combinations without any success and now ask you gurus what I should be doing. Thanks for any help I can get on this.I tried to zip a screenshot in but can't get it to upload again (this makes me crazy too). Hopefully, my description explains enough.
dwalther2
Regular User
Regular User
 
Posts: 26
Joined: 25 Apr 2009, 07:39

Re: Terrain Texture Detail

Postby Jesse Meyer » 18 Jun 2009, 15:36

That sounds right. If you have just 1 texture that isn't being repeated, then when the camera is near the terrain, it will look more blurry since the details stick out at a distance. More detail in less pixels at a range, and less detail in more pixels close up.

I'm not sure exactly what you are wanting to do. C4 does support detail maps. Are you using voxels? In any case, to add detail maps, you'll need to go into the shader editor and extend whatever shader you`re using to support an extra texture. Hopefully this process gets easier as the engine evolves.
Intel i5-4430
Nvidia 660 - Driver 340.43
8 Gigs RAM
User avatar
Jesse Meyer
Power User
Power User
 
Posts: 2795
Joined: 13 Jun 2008, 15:30

Re: Terrain Texture Detail

Postby Eric Lengyel » 18 Jun 2009, 15:54

File uploads should be working now. (There was a minor configuration problem on the new server.) Can you post a screenshot?
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby dwalther2 » 18 Jun 2009, 17:20

Here it is. Btw I did'nt use any shaders. Just brought in a texture and applied it to the terrrain. I am using the voxel terrain also. But I also tried it on collada file with the same appearance.
Attachments
screenshot.zip
(68.49 KiB) Downloaded 105 times
dwalther2
Regular User
Regular User
 
Posts: 26
Joined: 25 Apr 2009, 07:39

Re: Terrain Texture Detail

Postby Eric Lengyel » 18 Jun 2009, 17:48

The use of shaders is required in order to get the full-blown terrain shading capabilities. If you use the standard materials, then the terrain defaults to 2D texcoords that are stretched over the entire terrain, causing the blurry filtering that you're seeing. (It's possible to multiply the texcoords in the material manager so that the texture repeats across the terrain.) You're basically seeing last-gen texturing applied to next-gen terrain technology.

To get the full-blown terrain shading, you'll need to make a terrain palette eventually. To get you started with the terrain shader itself, you can import the sample material from Data/Tutorial/material/Terrain.mat. Then select all of the terrain pieces (best way is to select one, hit Ctrl-Up-Arrow to select the parent block, and then hit Ctrl-Down-Arrow to select all subnodes), and set the material using Ctrl-M.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby DeRatizator » 18 Jun 2009, 17:57

Eric, I suspect that there will be no end to this confusion until there will be a way to "compile" a palette in the editor itself (from source textures).

1) It would go like this, user creates block of textures and all slots are empty
2) User would have an option to add texture to a palette with texture selection dialog.
3) User would be promted to save new palette as separate file when saving the level.
What's wrong with that ?
AI
User avatar
DeRatizator
Power User
Power User
 
Posts: 1470
Joined: 23 Apr 2006, 19:00
Location: Latvia

Re: Terrain Texture Detail

Postby dwalther2 » 18 Jun 2009, 18:22

Thanks Eric. I figured it was something to do with the shader editor, etc. I will work on getting up to speed with the terrain pallette and associated things having to do with that.

@DeRatizator Yes, it is a bit overwhelming and hard to grasp with so many bits and pieces floating thru these forums and on the wiki about this. It would be nice to have a tutorial that spells it out for a newcomer to understand. Thanks again to all who have replied.
dwalther2
Regular User
Regular User
 
Posts: 26
Joined: 25 Apr 2009, 07:39

Re: Terrain Texture Detail

Postby Eric Lengyel » 18 Jun 2009, 21:31

There's a description of how to create a terrain palette in the Importing a Texture wiki article. It's very simple. A separate tool that let's you pick textures individually and combine them into a palette for import would be nice, but I don't think a high priority is justified for it.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby Frank Skilton » 18 Jun 2009, 23:17

Eric, how about including some terrain pallete material files (pre-exported .mtl files) like the ones you have for water etc. I know you can open the terrain tutorial world and export the terrain shader out yourself, but you know, it's the little things that make a difference.

Regarding detail textures, I haven't tried yet but I can't imagine it would be too difficult to add that feature in via the shader editor. One problem that I can forsee though is that you can't adjust the scale of individual textures, every texture in the shader is affected. Any plans on official support for detail textures?
Current project - ADF (Australian Defence Force)

Q6600 | 4 GB RAM | 8600 GTS 512MB | Win 7
User avatar
Frank Skilton
Community Leader
Community Leader
 
Posts: 3784
Joined: 20 Mar 2006, 19:00
Location: Australia

Re: Terrain Texture Detail

Postby Eric Lengyel » 19 Jun 2009, 01:04

Frank Skilton wrote:Eric, how about including some terrain pallete material files (pre-exported .mtl files) like the ones you have for water etc. I know you can open the terrain tutorial world and export the terrain shader out yourself, but you know, it's the little things that make a difference.


A sample terrain material file should be in the Data/Tutorial/material directory.

Frank Skilton wrote:Regarding detail textures, I haven't tried yet but I can't imagine it would be too difficult to add that feature in via the shader editor. One problem that I can forsee though is that you can't adjust the scale of individual textures, every texture in the shader is affected. Any plans on official support for detail textures?


The terrain shading is changing for version 1.6, and this kind of thing should be a lot easier.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby dwalther2 » 19 Jun 2009, 08:37

I've read the creation of pallette article in the wiki. My question is: What if you have just one each of the texture, normal and specular textures? If these textures are 2048^2 , then I assume each of these is brought in through the create pallette tick when importing. However, when I tried that, the cmd console said they were'nt the right size? Also, I noticed when looking at the example, it shows one single texture block in the shader editor tied to the multiply block. How does this come about? Finally, when you import the texture blocks into the pallette, how do you design a new shader. They come into the pallette but the wiki doesn't explain what to do from there. Sorry for being such a confused newcomer, but as I said in a previous post, things are'nt as clear to me as they might be to someone who has worked with the engine for a while. Just trying to learn and understand. Once I get my head around this, I probably write a wiki entry so others can understand. Again, thanks Eric and all for your input.
dwalther2
Regular User
Regular User
 
Posts: 26
Joined: 25 Apr 2009, 07:39

Re: Terrain Texture Detail

Postby Eric Lengyel » 19 Jun 2009, 15:42

dwalther2 wrote:I've read the creation of pallette article in the wiki. My question is: What if you have just one each of the texture, normal and specular textures? If these textures are 2048^2 , then I assume each of these is brought in through the create pallette tick when importing. However, when I tried that, the cmd console said they were'nt the right size?


A terrain palette must have at least two entries. If you change your textures to be 2048x4096 and just leave the bottom half black, then it should work.

dwalther2 wrote:Also, I noticed when looking at the example, it shows one single texture block in the shader editor tied to the multiply block. How does this come about?


When you create a chunk of terrain and paint materials on it, the material information is stored in the geometric data itself. This information includes the palette entries that you have set and then texture blending settings. The Terrain Texture shader process takes this data into account and uses it to perform up to six separate texture fetches, which are then blended together based on the normal vector and per-voxel blend data. What you get back is the single color representing the texture value at the particular pixel of terrain being rendered.

Things are more complicated for the normal mapping, and there are three Terrain Normal shader processes that must all be used. Their outputs are fed straight into the Terrain Diffuse Reflection and Terrain Specular Reflection processes.

dwalther2 wrote:Finally, when you import the texture blocks into the pallette, how do you design a new shader. They come into the pallette but the wiki doesn't explain what to do from there. Sorry for being such a confused newcomer, but as I said in a previous post, things are'nt as clear to me as they might be to someone who has worked with the engine for a while.


There's a blurb about this at the bottom of the following wiki article:

http://www.terathon.com/wiki/index.php/Editing_Terrain

A terrain shader is similar to an ordinary shader, except that you make some substitutions to the processes that you would ordinarily use.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby dwalther2 » 19 Jun 2009, 18:38

Thanks Eric. The bell finally went off in my head and I got a shader working and a terrain pallette built. I figured out that you needed more than one entry. 2 works but the black as second showed up first in the pallete and overlayed the entire terrain. The 2 minimum entry should be included on the wiki. It only refers to 9, 18, or 36 but no minimums that I could see. Also, I used the combination of the detail shader info and the terrain pallette creation article on the wiki, along with what you said to finally understand what's going on as well and to build mine. The one thing I have found out is I need to get more creative with my textures. Right now I have the same one repeating over and over and it looks funky. But, the good news is, the detail close up is great! Thanks again for the help and detailed responses on this.
dwalther2
Regular User
Regular User
 
Posts: 26
Joined: 25 Apr 2009, 07:39

Re: Terrain Texture Detail

Postby Twisted Helix » 30 Jan 2010, 22:37

Eric Lengyel wrote:To get you started with the terrain shader itself, you can import the sample material from Data/Tutorial/material/Terrain.mat.


Using both 2.0a2 and 2.0a3 I get the engine crashing in the unpacker class when trying to import this material, in C4Packing.h line 405 (didn't want to post code in this section). This happens with the Game project when trying to import the material into the material manager on a vanilla newly created world.
Project Reality - Arma2 : Wins Player Choice "Best Upcoming Mod of 2010" - ModDB
Twisted Helix
Power User
Power User
 
Posts: 836
Joined: 19 Feb 2009, 05:45

Re: Terrain Texture Detail

Postby Eric Lengyel » 30 Jan 2010, 23:05

There's a backward incompatibility in the material resource format that I need to iron out still. You can grab the same material from the Tutorial/Terrain world.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby Twisted Helix » 30 Jan 2010, 23:17

Cool ... I suspected it was a backwards compatible thing, I found the other terrain reference thanks. I notice that in the S value for the tex coords you have a value of 0.0625 set ... is this something to do with the 16x16 voxel cube .. ie the S coordinate is stretched to 16 times to cover the block now that the painting is per voxel ? If so why not the T coord ? When importing my terrain palette which was set to 1024 x (9 * 1024) I got the top two terrains halving the material manager box (and the terrain when created) when I had both S and T texcoords set to 1.0 ... setting both to 0.5 seems to give me the right result ... but I am curious as to what is going on here ?
Project Reality - Arma2 : Wins Player Choice "Best Upcoming Mod of 2010" - ModDB
Twisted Helix
Power User
Power User
 
Posts: 836
Joined: 19 Feb 2009, 05:45

Re: Terrain Texture Detail

Postby Eric Lengyel » 30 Jan 2010, 23:42

Twisted Helix wrote:I notice that in the S value for the tex coords you have a value of 0.0625 set ... is this something to do with the 16x16 voxel cube .. ie the S coordinate is stretched to 16 times to cover the block now that the painting is per voxel ? If so why not the T coord ? When importing my terrain palette which was set to 1024 x (9 * 1024) I got the top two terrains halving the material manager box (and the terrain when created) when I had both S and T texcoords set to 1.0 ... setting both to 0.5 seems to give me the right result ... but I am curious as to what is going on here ?


Only the scale for the S coordinate is relevant, and it is applied to all three planar projections for the terrain texturing. All this does is tell what to multiply the vertex positions by to get the texture coordinates. So a value of 0.0625 means that a texture repeats every 16 meters over the terrain.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby Twisted Helix » 31 Jan 2010, 01:40

Ah cool got it now thanks :)

Is there any way to get different tex coords affecting the two textures that blend in the terrain panel ?
Project Reality - Arma2 : Wins Player Choice "Best Upcoming Mod of 2010" - ModDB
Twisted Helix
Power User
Power User
 
Posts: 836
Joined: 19 Feb 2009, 05:45

Re: Terrain Texture Detail

Postby Eric Lengyel » 31 Jan 2010, 01:48

Twisted Helix wrote:Is there any way to get different tex coords affecting the two textures that blend in the terrain panel ?


Not in the current release, but it's actually something I'm in the process of adding right now.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby Twisted Helix » 31 Jan 2010, 02:01

Excellent :mrgreen:
Project Reality - Arma2 : Wins Player Choice "Best Upcoming Mod of 2010" - ModDB
Twisted Helix
Power User
Power User
 
Posts: 836
Joined: 19 Feb 2009, 05:45

Re: Terrain Texture Detail

Postby Twisted Helix » 02 Feb 2010, 04:00

Is there any way to derive the world position of the vertex a shader is operating on within the shader editor ?

I have derived the angle of the vertex face to a wolrd axis easily enough through using the object normal interpolator, but I would also like to derive positional information ... initially the z axis world position , so I can use it as an indicator of altitude on the terrain ... but it occurs to me having the x - y coords as well could be interesting for some maps. I might be missing something, but I can't seem to find a way of doing this.
Project Reality - Arma2 : Wins Player Choice "Best Upcoming Mod of 2010" - ModDB
Twisted Helix
Power User
Power User
 
Posts: 836
Joined: 19 Feb 2009, 05:45

Re: Terrain Texture Detail

Postby Eric Lengyel » 02 Feb 2010, 04:07

Twisted Helix wrote:Is there any way to derive the world position of the vertex a shader is operating on within the shader editor ?


This is one of the things I'm adding. The terrain texture coordinates are derived from the vertex position, so the information you need for altitude is already there, but it wasn't previously exposed in the shader editor.
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Re: Terrain Texture Detail

Postby JamesMK » 02 Feb 2010, 04:09

Sweet.

On a tangent note, will there be a way to expose the vertex ambient occlusion in a shader node as well?
User avatar
JamesMK
Community Leader
Community Leader
 
Posts: 908
Joined: 17 Oct 2007, 08:40
Location: Sweden

Re: Terrain Texture Detail

Postby Twisted Helix » 02 Feb 2010, 04:10

Cool, I figured it must be there somewhere if I couldn't find it I was going to try making it available as a script parameter to a scalar ... if that was possible, but I'll wait :)
Project Reality - Arma2 : Wins Player Choice "Best Upcoming Mod of 2010" - ModDB
Twisted Helix
Power User
Power User
 
Posts: 836
Joined: 19 Feb 2009, 05:45

Re: Terrain Texture Detail

Postby Eric Lengyel » 02 Feb 2010, 04:29

JamesMK wrote:On a tangent note, will there be a way to expose the vertex ambient occlusion in a shader node as well?


It's already there. The ambient occlusion is stored in the alpha component of the vertex color interpolant. (And for terrain, the blue component contains the texture blend factor.)
User avatar
Eric Lengyel
Terathon Employee
Terathon Employee
 
Posts: 18775
Joined: 09 May 2005, 19:00
Location: Roseville, CA

Next

Return to Artist Central

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

Company Contact Privacy Policy Site Map Copyright © 2001–2014 Terathon Software LLC Terathon Software