View unanswered posts | View active topics


Post a new topicPost a reply
Previous topic | Next topic 

User avatar   Skilled Modder Skilled ModderMember since: 30.04.2010, 14:42Posts: 714Location: Russia Likes: 22
 

 Post Topic: Re: Google SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 27.06.2012, 14:05 
8. Additional tutorial: FP16
working with engine limitations


This tutorial covers the issue that is present only in the late iterations of CryENGINE3. It is not mandatory if you're working with an early Educational release of this engine or with CryENGINE2.

8.1. Introduction

CryENGINE3 employs half-precision floating-point format (FP16) to store the coordinates of vertices in geometry. This gives better performance, but has serious drawbacks: obviously, in some cases, it lacks the precision necessary to represent a geometry properly. Distortions occur, especially in objects of large size with relatively small details, on curved surfaces, and in other complicated cases.

Let's take a look at how this works and how to squeeze the highest precision possible out of that format.

Easiest way to think of the vertex position format limitations is to imagine a 3-dimensional grid. Like this:

Image

Essentially, every intersection of that grid is one possible position that can be occupied by a vertex. Smallest possible step in any direction equals is a grid step size.

Image

Of course, actual range of values of FP16 is bigger. If I remember correctly, it allows 2048 or 1024 possible positions on each axis. So you should imagine a denser grid, closer to something like this:

Image

So, how does it work when your geometry is exported into the engine? Let's take a look at one example. Here is a curve that could have been a part of some complex big object, and a grid of possible values in relation to it:

Image

I think it will be easier to explain if I use 2d grid, hence no third axis, too much visual clutter. So, what will happen with the vertices of our curve? They will be moved to nearest possible position:

Image

Obviously, this isn't nice. Such distortions can often break detailed curves, turn edges with slight slopes into entirely parallel to one axis, or, even worse, merge several vertices into one point. So let's see if we can minimize that impact. We will use a simple flat component like this:

Image

One note before we proceed: everything I cover here is only relevant to the parent component in your object hierarchy, one that you will be exporting. Pivot position and other axes-related settings in sub-components don't matter, as CryENGINE3 exporter is seeing your model as a solid one-layer object, reading only the pivot from the highest component in the structure.

So, as you know, your SketchUp model has coordinate axes and a central point (pivot). Also, each and every component has it's own inner central point, and can even use it's own directional setup of axes. We are particularly interested in the pivot of the parent component, one you will be exporting into the engine. Open it for editing, and you will see this point, with axes intersecting in it:

Image

This is the default pivot position SketchUp creates in every component: corner of the bounding box. Now, what determines the grid precision is, first of all, the scale of your object. In this case, the dimensions are 2.6x2m:

Image

So the grid will be scaled to cover that 2.6x2m area? Unfortunately, no. The possible range of vertex positions has to cover both negative and positive values to an equal extent. So, actually, these are base dimensions: 2.6m both ways and 2m both ways:

Image

This way, your entire geometry is encompassed in the grid range, and the range is equal on both sides of zero. Looks like this:

Image

As you can see, it's a horrible waste: 3/4 or possible range is not employed to describe your geometry. And when we take 3d grid, it's even worse: 7/8 of range goes nowhere.

But there is a very obvious solution to this: why can't we just move the pivot to a point that is equally distant from extreme points of an object from each axis? Like this:

Image

Image

Now we have equal 1.3m and 1.0m distances from the center point to each border. And here is how it will affect the grid of possible vertex positions:

Image

It's four times better (8x if we're talking about actual 3d)! To complete this example, let's take a look at how this object will change when nearest possible vertex positions will be used:

Image

8.2. Example

Now let's take a look at the real asset and at how can we do the same trick with it. Let's say we have a building. First we should determine the dimensions of the object - center points of these lines will help us to find the place where pivot should be situated. Drawing these lines should be easy:

Image

Next, we'll need the midpoints of those lines.

Image

From them, we can draw the central point of the whole object:

Image

Here it is with non-hidden building model:

Image

Now all we need to do is just to move the pivot to that point. Open the parent component for editing, click on RMB anywhere in empty space, and choose the Change Axes context menu option:

Image

Carefully fix the axes on that point (don't mess their directions up):

Image

And we're done!

Image

Now, compare how the grid would've looked without our intervention, and how it looks now:

Image

Image


8.3. Notes

  • Ideal pivot placement is not crucial, you won't lose much of the precision if you have a slight offset. It's just easier sometimes, as just drawing lines from dimensions midpoints saves you some time thinking.
  • If your object vertical dimensions are significantly lower than horizontal ones, you can place the pivot on the horizontal intersection below, without raising it up. Vertex precision on your vertical axis is high anyway, and you will save yourself some time in the editor, as you won't need to excavate your buildings from underground. It is especially recommended for small props or anything else you'd like to place frequently. Precision < headache, especially if you'll need to place 10000 trashcans or something like that.
  • Sometimes, even ideal pivot position does not cut it, and you still see intolerable precision artifacts on your model. If distortions are too severe, consider splitting your model into several smaller ones. One golden rule for this is to always place pivots of the parts on a regular grid (for example, with 1m step), so that it will be extremely easy to assemble them in the Editor (by turning on grid snapping). In this case, again, maintaining ideal center position is not too important, just make sure pivot is placed on the closest grid intersection to the center.


Last edited by bac9-flcl on 13.08.2012, 11:28, edited 1 time in total.

  Beginner BeginnerMember since: 20.06.2012, 22:05Posts: 35 Likes: 0
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 16.07.2012, 19:05 
I can get the sketchup model to export and viewed in cryengine editor. Unfortunately, I am having a lot of trouble with the materials. How do you get the materials to be carried over into cryengine as well?

thanks
User avatar   Community Rep Community RepMember since: 14.12.2009, 17:10Posts: 1222Location: Cheshire, UK Likes: 67
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 12.08.2012, 22:13 
Check the front news page. WHAT!?


Image

No support via PM, please use the forums
User avatar   Uber Modder Uber ModderMember since: 05.11.2011, 16:26Posts: 1967Location: Czech Republic Likes: 49
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 13.08.2012, 09:22 
Yop, It's in News post ;) Good job
User avatar   Trained Modder Trained ModderMember since: 03.02.2008, 15:31Posts: 396 Likes: 1
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 13.08.2012, 09:38 
Thanks, nice explanation. Still would prefer if CE goes the more flexible route and adds a switch of sorts for those who don't need the performance but require the precision.


creative director/lead animator @ open Outcast
User avatar   Skilled Modder Skilled ModderMember since: 30.04.2010, 14:42Posts: 714Location: Russia Likes: 22
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 13.08.2012, 11:11 
Wow, thanks, Kaneth! :D

I should update the post a bit - I've found an awesome plugin that can center pivot positions automatically, even allowing you to choose which axes should be taken into account (which is practical for small and widely used props with desired XY+bottom pivot position, as I've said earlier).

Image
http://forums.sketchucation.com/viewtop ... 23&t=30508

With this, there are only a few cases left where you'll have to move your pivot manually. These are modular objects (where exact centering is not suitable and you have to place pivots in approximate centerpoints on an arbitrary grid); and for LoD objects (there, if there is a difference in extreme points between detail levels, you will have a displaced centerpoint, which will look ugly on level of detail switching).

Hooray!
User avatar   Beginner BeginnerMember since: 13.08.2012, 21:01Posts: 1 Likes: 0
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 13.08.2012, 23:15 
mhmhmhmhmh
  Beginner BeginnerMember since: 31.08.2011, 13:54Posts: 1 Likes: 0
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 14.08.2012, 15:30 
Half float gives really good precision, enough for any ingame geometry.
http://en.wikipedia.org/wiki/Half-preci ... int_format
User avatar   Skilled Modder Skilled ModderMember since: 30.04.2010, 14:42Posts: 714Location: Russia Likes: 22
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 14.08.2012, 15:34 
Quote by St1X:
Half float gives really good precision, enough for any ingame geometry.
http://en.wikipedia.org/wiki/Half-preci ... int_format

Mostly, yes. But some objects like highly detailed large vehicles are bound to have problems, and these usually can't be separated into several objects like buildings.

Not to mention that even though buildings can be separated into smaller blocks to ensure that stuff like detailed arcs or destruction detail is well-preserved, every additional .cgf makes an unwanted contribution to DP count. Not a problem if you're working on a small scene, but with e.g. a vast cityscape containing lots of large and detailed objects, that's not good. Hence the tricks to squeeze additional precision whenever possible.
User avatar   Trained Modder Trained ModderMember since: 03.02.2008, 15:31Posts: 396 Likes: 1
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 14.08.2012, 16:20 
fp16 has it's reasons and is fine, but again, it would be very cool to have that as some switch... for projects that don't require speed but prefer precision (as crytek is targeting really wide area of usage)


creative director/lead animator @ open Outcast
User avatar   Beginner BeginnerMember since: 22.08.2011, 13:44Posts: 63Location: Germany Likes: 9
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 15.08.2012, 12:09 
FP16, i see..
Now I know why my 0.8mm base boards disappears on the large distance from the pivot.. :whatever:
Suppose, to solve this proplem I have to separate them and set as individual objects.
User avatar   Trained Modder Trained ModderMember since: 25.02.2009, 17:02Posts: 224Location: Germany Likes: 42
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 27.08.2012, 16:28 
thumbs up for this piece of well written tutorial !

this will help people to enter the world of modeling !

:love:
  Beginner BeginnerMember since: 29.06.2012, 03:41Posts: 33 Likes: 0
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 30.10.2012, 15:57 
So here is my problem.
I have been having the same problem. I keep have the "replace me" over my object. Its not the red one. My texture appears to be overlapping or something. I have read the sketchup post here a few times and it hasnt resolved my problem. Here is a screen.

http://i1060.photobucket.com/albums/t45 ... 5755pm.png

everything shows up like the roof. Not the door.


I have also reimported all my tiffs. Some will open with RC but most of the time the command prompt will just run and close.

Here is what im saving them as in photoshop

http://s1060.beta.photobucket.com/user/ ... m.png.html
User avatar   News Posters News PostersMember since: 04.12.2007, 03:23Posts: 11791Location: Hamar, Norway Likes: 712
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 30.10.2012, 20:18 
Sticky for being an awesome extensive tutorial on Sketchup.
Thanks for helping out the CryDev community bac9-flcl.


 
 
 

Image
User avatar   Skilled Modder Skilled ModderMember since: 30.04.2010, 14:42Posts: 714Location: Russia Likes: 22
 

 Post Topic: Re: SketchUp for CryENGINE 3 | Extensive tutorials
PostPosted 30.10.2012, 21:04 
Wow, thanks! :)
To celebrate, here is a little gem I've found:

[Plugin] Axes Tools (1.1.0) / Link

Image

I urge everyone to install this great plugin. Image says it all: my post on the subject of manual fiddling with axes is now mostly obsolete. Using this plugin, you can instantly set your component axes however you like.

There is only one instance where you'll have to edit axes manually now: when working on a modular object (as perfectly centered pivots aren't that relevant there, instead you have to make sure every pivot sits on an arbitrary grid).

All glory to ThomThom! :)

***

On a side note, I'm working on an updated version of this guide, which most probably will be posted as .pdf. You know, to avoid dead image links, choking the browsers with the first page, and wrong font colors (the horror) whenever this gets reposted elsewhere.