www.quadsoftware.com
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  Usergroups
Register  ::  Log in Log in to check your private messages


Post new topic  Reply to topic
 Esperient Creator « View previous topic :: View next topic » 
Author Message
Chaplaindm
PostPosted: Tue Feb 08, 2011 2:39 pm    Post subject: Esperient Creator Reply with quote



Joined: 10 Jan 2009
Posts: 15
Location: USA

I am using GROME and trying to tie it in with Esperient Creator. EC is really great about allowing just about any format. At present I am able to import the Collada model of the terrain (I am using your Demo) and the textures also come in.

At this point I am trying to combine these texture so I can apply them to the terrain model. Below is a video of my trying this.

http://www.heritage-lost.com\GromeTest3.mp4 (copy and paste all of this into your browser. For some reason the video link doesn't show)

Anyone want to look at it and give me some advice on how to continue? I am pretty new to GROME and the Collada format. I understand the diffuse texture but what are the textures with the wavy lines?

Thank You!
CH Mitchell[/url]
Back to top
View user's profile Send private message Visit poster's website
ALicu
PostPosted: Wed Feb 09, 2011 8:08 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1328

Hi,

Terrain texturing is always pretty complicated (that is why there are special terrain engines, because of this and of the LOD that can be applied with them).

For terrain, to increase the apparent resolution of texturing, multiple layers are used. In the simplest form one layer contain only one diffuse texture and the mask (the black and white texture you've shown in your movie) that indicates where the diffuse texture is visible. So, for example, you can have two layers, one of grass and one of rock. You can generate the grass layer mask so it is white (where the grass is visible) only on the low slopes and generate the rock mask to be visible only on high slopes. That's why you see the masks with strange contours for white, they are following the geometry of the terrain. Of course you can also manually adjust the masks (with brushes) where you want.

So in the simplest forms the layers are combined in this way. So you need to create a special material that takes four textures, 2 diffuse (grass and rock) and 2 masks (for both layers), and combine them using a formula similar with this:

FinalColor = Grass * GrassMask + Rock * RockMask

As a programmer, for the above formula, you can either use a pixel shader or a fixed pipeline rendering state sequence. I don't know what EC supports (if it allows you to manually enter shaders, if you can assemble materials inside its U.I. etc). For example, in the UnrealEditor, you can assemble materials in its UI:
http://www.idi.ntnu.no/~joskj/stuff/From_GROME_to_UDK.pdf

This is a mini tutorial made of one of our users. Here are more details:
http://www.quadsoftware.com/forum/viewtopic.php?t=550&postdays=0&postorder=asc&start=0

The things get more complicated when you have more than 2 layers. You can end up using all the texturing units of the video cards and you need to do multiple rendering passes. Also, there are layers in Grome that are not simple as the ones from above. There are layers with multiply as operation, with lighting etc. All these complicate the combination formula.

Graphite was made to create all this functionality for the user. It does all the layering dirty job and also a lot of optimizations. You can try to use its SDK and integrate it into EC if this editor allows external code.

Collada, it is a generic mesh format, it is not designed to contain terrain. The terrain is usually a grid-like structure and various LOD mechanism can be used for visibility. All these are lost when you treat it as a generic mesh.

The current Collada exporter was meant mainly as a way to have Grome terrain inside generic modelers like 3DS Max, Maya etc. There it is no longer suitable for real-time rendering. Users can use it for snapshots, rendering of images etc.

But there is one simple way to have the Grome texturing inside the external programs. You can bake (combine) the layers into one single layer inside Grome before exporting. You loose some resolution (since you create one single non-tiled texture) but the general look is the same.

For this, create one layer of texturing on top of all the others. Assign it to zones. At assign dialog press New button at Texture and choose a resolution (for example 1024x1024). Choose "Simple Color" at Layer Shading Configuration and press ok. Now mark this layer in-use (press the red button next to it) and open the ColorBake tool (from Texturing -> Procedural in the tools panel on the left). Press Apply. All the visible layers will be baked (rendered) in this in-use layer. Next mark all the other layers as not visible (press the eye button next to them) and export.

Now you have one single texture on the collada mesh which should be visible in TC.

Otherwise, if you still need to keep the high res, you can try to create a material in TC to emulate the Grome layering. More information about the layering you can find the SDK documentation (in GromeSDK.chm from SDK/Grome folder). In the documentation look at Advanced Topics -> Terrain Texture Layers Configurations).

But this is a pretty hard task. You need to know about shaders, rendering passes, optimizations etc.

Let me know if you need more information.

Best Regards,
Adrian L.[/url]
Back to top
View user's profile Send private message
Chaplaindm
PostPosted: Wed Feb 09, 2011 8:11 am    Post subject: Reply with quote



Joined: 10 Jan 2009
Posts: 15
Location: USA

I have one of the Esperient Creator support staff helping me with this.

Here is another link to the video. This time on Youtube

http://www.youtube.com/watch?v=PUo01xJc5yU

Terrabite poses a good question as we are discussing this on the following thread. http://www.esperient.com/userforum/showthread.php?t=1332

Does Grome export the mask layers along with everything else? Is that what the wavy line TGA files are?

Give me a hand please! Integrating GROME into EC would be a boost for us all. EC is used by a lot of industry and has just produced a Augmented Reality line. GROME is a great fit once we get it working.

Chaplain
Back to top
View user's profile Send private message Visit poster's website
ALicu
PostPosted: Wed Feb 09, 2011 8:18 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1328

Hi,

Yes the tga are the masks. The collada exporter I believe exports one mask per layer per tga file (greyscale). White is were the texture is visible and black were is not (in-between grey values indicate partial amount of visibility).

In case a different way of masks packing is needed you do have the source code of all the exporters and you can modify them. But you will need some programming skills for this.

I've read the other forum thread and it seems you need to create special shaders for the terrain (they support only additive layering). What kind of shaders do they use? DirectX FX files? You will need to get into shading programming for this and know at least basic knowledge about it. There are a lot of documentation about it and I can provide the information about the layering in Grome, but first you will need to understand the basics of shading.

Regards,
Adrian L.
Back to top
View user's profile Send private message
Chaplaindm
PostPosted: Wed Feb 09, 2011 9:25 am    Post subject: Reply with quote



Joined: 10 Jan 2009
Posts: 15
Location: USA

Alicu,

Thanks for the great response. My understanding is that EC uses the Direct X fx files for shaders.

It sounds like it is possible to create the GROME materials inside of Esperient Creator but it will take a shader. I am also going to try and bake all the textures into a single material and then import it.

One question on this. Wouldn't there be an issue with the material stretching vertically on the cliffsides unless it was really high res? Or does GROME already account for this?

Two, EC does allow plug in applications. I am not quite sure how this would work. Does Graphite BECOME the rendering portion of the software? If so, how does it handle indoor scenes? Or does it simple take care of the outdoor terrain such as LOD and texturing.

Edit: I forgot to ask. Does it cost me anything if I want to use Graphite inside of Esperient Creator via a plug in? I am an indie user.

Thank You,
Chaplain
Back to top
View user's profile Send private message Visit poster's website
ALicu
PostPosted: Wed Feb 09, 2011 9:35 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1328

Hi,

Quote:
One question on this. Wouldn't there be an issue with the material stretching vertically on the cliffsides unless it was really high res? Or does GROME already account for this?


If you have multiple layers, in Grome, you can indicate various orientations for the texturing. So for layers covering big slopes you can use a vertical projection of the texturing. You can find more of this in the procedural texturing video tutorial:

http://www.quadsoftware.com/index.php?m=section&sec=product&subsec=editor&target=Editor/tutorials_procedural

But once you baked the layers you loose this projection (the baked image is projected from above) so you will have stretching.

Implementing multiple layers is hard and multiple layers with custom projection is even harder (even though some users implemented this in their engines). Graphite deals with this exactly as Grome.

Quote:
Two, EC does allow plug in applications. I am not quite sure how this would work. Does Graphite BECOME the rendering portion of the software? If so, how does it handle indoor scenes? Or does it simple take care of the outdoor terrain such as LOD and texturing.


Graphite was designed to be integrated in external engines. It has a documented SDK but you need a good knowledge of programming for it.

If integrated, it will deal only with terrain rendering and should not interfere with the rest of engine. It can even allow custom rendering passes to be added on top, usage of custom console, memory allocation functions etc.

For Grome users, Graphite is free of use in binary form for non commercial applications. But it is not free of use for others, which don't have at least one Grome license. So while this will be free for you, others may not be able to use it. Also, it is free only for non-commercial applications but we can arrange advantageous deals for various users depending on their contribution for Grome community.

Best Regards,
Adrian L.
Back to top
View user's profile Send private message
Chaplaindm
PostPosted: Thu Feb 10, 2011 8:13 am    Post subject: Reply with quote



Joined: 10 Jan 2009
Posts: 15
Location: USA

Thank you for the information. It is up to me now to do some work on this.

Chaplain
Back to top
View user's profile Send private message Visit poster's website
Chaplaindm
PostPosted: Thu Feb 17, 2011 8:35 am    Post subject: Reply with quote



Joined: 10 Jan 2009
Posts: 15
Location: USA

We are still working on this and will let you know if we get it working. Esperient Creator is a great program for adding functionality to existing scenes but has no in-built terrain tools.

One last question. Are we free to use all of GROME's assets and textures in our own applications? It is probably a no-brainer but I still need to ask.

Chaplain
Back to top
View user's profile Send private message Visit poster's website
ALicu
PostPosted: Thu Feb 17, 2011 8:38 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1328

Yes, they are free for use for Grome clients, for any type of application.

Regards,
Adrian L.
Back to top
View user's profile Send private message
Chaplaindm
PostPosted: Thu Feb 17, 2011 11:10 pm    Post subject: Reply with quote



Joined: 10 Jan 2009
Posts: 15
Location: USA

We are getting closer to creating the Shader FX to import the textures from GROME into EC. However, it is getting a little over my head. Terrabite (the EC team) is ready to write the shader but needs a few questions answered.

His last post to me is below:

"quote"
No problem, just tell me how many textures you have and if any need a different map channel and I'll generate a ShaderFX shader for you. It will allow you to set the tiling for each texture independently. Also, does it need a place for a light map? and what channel will it use?

After experimenting with this stuff, I think the RGBA format for putting 4 masks into one texture is the way to go as it takes up less memory at run time. A 512x512 image will use 1,048,576 k in memory regardless of format so your savings are well worth the trouble. It should be easy to put the tgas together in Photoshop or some other program. I'm guessing that order will not matter because as you paint on one mask, the rest receive an equal amount of black. "end quote"

You can always reference the whole thread if you need to. I posted the link earlier in this thread.

Can you help me out with this?
Thank You,
Chaplain
Back to top
View user's profile Send private message Visit poster's website
ALicu
PostPosted: Fri Feb 18, 2011 8:36 am    Post subject: Reply with quote



Joined: 12 Feb 2007
Posts: 1328

Hi,

About the layers configuration, in Grome you can have any layer configuration you want:
- you can add as many layers as you want
- you can select various ways to treat the layer: simple colors, masked texture, multiply, add etc.
- for each layer you can choose a different mask size, tiling, rotation, offset of the UV etc.

So Grome is pretty versatile and it will allow you any combination you can think of. But to create one shader for each combination would be tremendous work. So I recommend you decide on a certain configuration that is best suited for your case.

For example, you can choose maximum 4 layers of texturing. Each layer has a mask and a diffuse texture. All mask have the same size. For the shading of each layer you choose "Masked texture" (the most common one). Each layer can have its own tiling, but no offset and rotation of textures (this can be added later).

Now, for export you can choose to pack 4 the masks into RGBA of one single texture. For this you can use the General Data Sets Exporter and choose the option "Export as multiple image channels". The exporter will also take care to use the biggest size of the texture in case layer masks have different sizes and scale masks to that size.

So for the material you will have 5 textures in total: 4 diffuse and one with the masks. You may increase the layers number to 6 (6 diffuse textures and 2 masks images, one fully occupied and one only with the red and green occupied) for a total of 8 textures (most of the video cards today support at least 8 image samplers).

You may also support more layers than that and decide to go multi-pass rendering.

Depending on your material you may also need to choose "Normalize each channel" (from the plugin UI) so the total value of each channels added together is 1.0.

NOTE: for DDS format it is not a good idea to have masks packed as separate channels. DDS is a quality-loss compression format which compresses RGB and Alpha separately. If you have one mask in each of the R G B channels they are severely crippled by the compression. On the other hand if you have one mask duplicated in RGB and another in Alpha (only two masks per image instead of four) the compression is fine. You need to decide either to use DDS or other image format (which end up uncompressed on video memory). From my experience DDS with 2 masks per channel is better (from video memory point of view) than an uncompressed image with 4 masks in it. But you may need fewer images occupied for the pixel shader samples so you may choose non-DDS case.

This exporter also saves the heightmap as 16 bit raw this may help you to import in EC or you can use collada format for the heightmap.

Also if TC doesn't support special terrain rendering you may have a very low performance. You may need to look into ways to apply terrain LOD in TC (for both heightmap and texturing).

Best Regards,
Adrian L.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Based on a template by Dustin Baccetti
Powered by phpBB © 2001, 2005 phpBB Group