Outerra forum

Anteworld - Outerra Game => Modding: Importer, Tools & Utilities => Topic started by: M7 on April 16, 2013, 03:38:13 pm

Title: Importing building from sketchup with texture
Post by: M7 on April 16, 2013, 03:38:13 pm
I've been trying to import buildings from a  sketchup .dae file. First i convert jpg images to dds using Nvidia photoshop plugin. Then i opened the empire_state.dae file with wordpad. i replaced all .jpg and .png name with .dds.

i load up Outerra and import the empire_state.dae and here what i'm getting... some textures did appear on the ouside faces of the building and some appeared on the inside. Anybody have an idea as to what went wrong?

I'm still happy that i got some textures to show up correctly though.


(http://imageshack.us/a/img15/5765/empirestatez.jpg)

Title: Re: Importing building from sketchup with texture
Post by: M7 on April 16, 2013, 04:16:18 pm
Think i know what i did wrong. In photoshop i did resized the texture using 'image size' instead of using 'canvas size' command. In sketchup, if resize a texture (using photoshop) and do through 'image size', the texture show up all distorted. So it might be the reason why the textures show on the wrong side of the building faces in Outerra.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 16, 2013, 04:42:11 pm
Hmm, using 'canvas size' instead of 'image size' didn't do anything :-(
Title: Re: Importing building from sketchup with texture
Post by: Timmo on April 16, 2013, 06:56:22 pm
It's probably because some faces are turned inwards (in sketchup, these appear as a more purple shade when untextured)- These may need to be turned outwards as a lot of 3D engines cull the backfaces of planes to improve performance?
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 16, 2013, 09:21:30 pm
On the left, i kept the sketchup file pretty much as is with lots of hierarchy of components and groups. The  grenade launcher and the gun on top were quite deep in the hierarchy. That might be the reason the texture does not come out right.

On the right, i exploded all groups and  components and kept only the chassis and the 8 wheels components. All textures look ok.

Was also successfull to import it as vehicle  but could not use cameni's tank script yet. Will try to make a video (Haven't figured that out yet).

(http://imageshack.us/a/img507/7523/texturecomparaison.jpg)


Title: Re: Importing building from sketchup with texture
Post by: M7 on April 17, 2013, 12:04:43 am
OK my first video ever on youtube. The sound is pretty bad even in the original wav file (so i added music). Will have to read again the video thread.

 I just want to add that it's an amazing experience to get to play with 3dr party models and incorporate them into the game engine. Great job Outerra team! This thing is such a beauty! (the engine)

outerra centaur (http://www.youtube.com/watch?v=qIrn4TGFTu0#)

Title: Re: Importing building from sketchup with texture
Post by: M7 on April 17, 2013, 12:39:51 am
I exploded all the components and group. Still nothing changes

(http://imageshack.us/a/img402/3007/empirestate2.jpg)

Quote
It's probably because some faces are turned inwards (in sketchup, these appear as a more purple shade when untextured)- These may need to be turned outwards as a lot of 3D engines cull the backfaces of planes to improve performance?

I checked the sketchup model without the texture and all external face look the same ....
Title: Re: Importing building from sketchup with texture
Post by: ZeosPantera on April 17, 2013, 12:53:58 am
I just want to add that it's an amazing experience to get to play with 3dr party models and incorporate them into the game engine. Great job Outerra team! This thing is such a beauty!

Are you waiting to release until you get it all settled?
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 17, 2013, 01:58:00 am
Well here it is. Its the first time i share something with google drive, so i'm not sure it will work right away

https://docs.google.com/file/d/0B96RrTcNJsI2VHJOYXU2S2QtYTA/edit?usp=sharing
Title: Re: Importing building from sketchup with texture
Post by: ZeosPantera on April 17, 2013, 03:29:55 am
Tweaky Tweaky..

Code: [Select]
//invoked only the first time the model is loaded, or upon reload
function init_chassis()
{
  var wheelparam = {
    radius: 0.6,
    width: 0.265,
    suspension_max: 1.0,
    suspension_min: -0.20,
    suspension_stiffness: 14.0,
    damping_compression: 0.05,
    damping_relaxation: 0.2,
    slip: 0.70,
    roll_influnce: 0.1,
    rotation: -1,   
}
 
  this.add_wheel('wheel_0', wheelparam);
  this.add_wheel('wheel_1', wheelparam);
  this.add_wheel('wheel_2', wheelparam);
  this.add_wheel('wheel_3', wheelparam); 
  this.add_wheel('wheel_4', wheelparam);
  this.add_wheel('wheel_5', wheelparam);
  this.add_wheel('wheel_6', wheelparam);
  this.add_wheel('wheel_7', wheelparam);
 
  //sounds
  this.load_sound("diesel-engine-start.ogg");
  this.load_sound("diesel-engine-idle.ogg");
  this.add_sound_emitter("wheel_0");
 
  return {mass:7315, steering:2.0, steering_ecf:20, centering:2.0, centering_ecf: 20,
  com:{z:0.8, y:-0.6, x:2 }};
}

//invoked for each new instance of the vehicle
function init_vehicle()
{
  this.set_fps_camera_pos({x:1.7,y:-1.0,z:3.6});
  this.snd = this.sound();
  this.snd.set_ref_distance(0, 9.0);

  this.started = 0;
}

function engine(start)
{
  if(start) {
    this.started=1;
    this.snd.play(0, 0, false, false);
  }
}


const EF = 12000.0;
const BF = 4000.0;
const maxkmh = 40;
const forceloss = EF / (0.4*maxkmh + 2);


//invoked each frame to handle inputs and animate the model
function update_frame(dt, engine, brake, steering)
{
  var kmh = this.speed()*3.6;
 
  //reduce engine force with speed (hack)
  var redux = engine>=0 ? 0.2 : 0.6;
  var esign = engine<0 ? -1 : 1;
  engine = EF*Math.abs(engine);
  var force = (esign>0) == (kmh>=0)
        ? engine/(redux*Math.abs(kmh) + 1)
        : engine;
  force -= forceloss;
  force = Math.max(0.0, Math.min(force, engine));
  engine = esign*force;


  steering *= 0.40;
  this.steer(0, steering);
  this.steer(1, steering);
  this.steer(2, steering);
  this.steer(3, steering);
  this.steer(4, -steering);
  this.steer(5, -steering);
  this.steer(6, -steering);
  this.steer(7, -steering);
 
 
  if(this.started>1)
    this.wheel_force(0, engine);
    this.wheel_force(1, engine);
    this.wheel_force(2, engine);
    this.wheel_force(3, engine);
    this.wheel_force(4, engine);
    this.wheel_force(5, engine);
    this.wheel_force(6, engine);
    this.wheel_force(7, engine);
 
  brake *= BF;
  this.wheel_brake(-1, brake);

  if(this.started==1 && !this.snd.is_playing(0)) {
    this.started=2;
    this.snd.play(0, 1, true, false);
  }
  else if(this.started==2) {
    var pitch = Math.abs(kmh)/20.0;
    var g = kmh>0 ? Math.floor(pitch) : 0;
    var f = pitch - g;
    f += 0.5*g;
    this.snd.set_pitch(0, 0.5*f + 1.0);
  }
  this.animate_wheels(); 
}


Give that a whirl. I also attached it.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 17, 2013, 10:38:53 am
that's cool! actually i was not sure how these things were driving in real life so i tried to make it look a bit like it was driving like a tank, by giving  all wheel  a very low turning rate. But i just saw it's actually driving like a tatra. I'll have to check more in detail to see what other tweaks you made.
Title: Re: Importing building from sketchup with texture
Post by: ZeosPantera on April 17, 2013, 12:45:52 pm
Basically Less Tire Grip, Less Power, More steering lock but much slower at speed.. I played with the Center of gravity for a while. That is easiest done by setting the spring really low and the dampening to 0.. Then you can see how she leans and adjust. Also softened up the suspension a bunch and tried to make it so when you stopped short you got a bit of a rock forward before returning to rest. Raised the Max KPH to 80 from 60.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 17, 2013, 01:13:47 pm
Sounds good. I have this other one that i'm looking to import. I found out it has the axles modeled so might be interesting to try to replicate how each axle move. i think the front 4 wheels are on the same axle, then separate axle for each wheels (same for the 4 back). I have an idea as how these should behave but not sure if it's possible to script with outerra bones. Think i could be in for a week to try to figure this stuff out :-)

(http://imageshack.us/a/img585/2774/panzerw.jpg)
Title: Re: Importing building from sketchup with texture
Post by: ZeosPantera on April 17, 2013, 03:10:10 pm
Probably not possible yet in OT.. There was the discussion on getting a standard 4-link to work and that stuff isn't implemented yet.

That looks more like the tatra's suspension.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 17, 2013, 03:26:12 pm
yeah just saw that discussion. Might try a fake animation with just the axles and wheels (no chassis), something similar to hhrhhr buggy, just to learn how these things work. That buggy looks so cool.
Title: Re: Importing building from sketchup with texture
Post by: Foxiol on April 17, 2013, 04:00:31 pm
Very good model. Thanks to share it ;) and good tweaks Zeos too.

Hope Cameni can help you with the textures of the Empire State. ;)
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 18, 2013, 12:42:56 am
Sd.Kfz.234/4  It kind of weird how  regular paint color in sketchup look really different once imported in Outerra. Like the tires are supposed to be dark gray. The textures though, look similar as in sketchup.

https://docs.google.com/file/d/0B96RrTcNJsI2NmJKQWZpOWVFdmM/edit?usp=sharing (https://docs.google.com/file/d/0B96RrTcNJsI2NmJKQWZpOWVFdmM/edit?usp=sharing)

(http://imageshack.us/a/img594/4286/sdkfz2344.jpg)
Title: Re: Importing building from sketchup with texture
Post by: cameni on April 18, 2013, 01:11:29 am
The importer can't handle all material definitions from all types of modeling programs yet (it's not very unified), so you have to manually edit the material file to get the right look for now.
Title: Re: Importing building from sketchup with texture
Post by: cameni on April 18, 2013, 01:16:22 am
I exploded all the components and group. Still nothing changes

(http://imageshack.us/a/img402/3007/empirestate2.jpg)

Quote
It's probably because some faces are turned inwards (in sketchup, these appear as a more purple shade when untextured)- These may need to be turned outwards as a lot of 3D engines cull the backfaces of planes to improve performance?

I checked the sketchup model without the texture and all external face look the same ....

Likely a problem with some meshes facing inwards. OT doesn't support two-sided materials (unnecessary perf issue), so all meshes must be facing properly. Maybe the backface culling can be enabled in Sketchup for the object too, to see it.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 18, 2013, 11:49:18 am

The importer can't handle all material definitions from all types of modeling programs yet (it's not very unified), so you have to manually edit the material file to get the right look for now.

I think ill' make some box in sketchup with somekind of color chart painted on them to have a better idea of what to expect.



Likely a problem with some meshes facing inwards. OT doesn't support two-sided materials (unnecessary perf issue), so all meshes must be facing properly. Maybe the backface culling can be enabled in Sketchup for the object too, to see it.
I'll check that out.

I'm such a noob with anything involving 3D software but i enjoy the inquiry part of it so far. I'll try with some more boxes in sketchup with front facing and back facing with both paint and textured on them.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 18, 2013, 12:04:38 pm
Basically Less Tire Grip, Less Power, More steering lock but much slower at speed.. I played with the Center of gravity for a while. That is easiest done by setting the spring really low and the dampening to 0.. Then you can see how she leans and adjust. Also softened up the suspension a bunch and tried to make it so when you stopped short you got a bit of a rock forward before returning to rest. Raised the Max KPH to 80 from 60.

Looks like i didnt red this through the first time. These are great tips to find more precisely the center of mass and great tweaks too. Thanks!
Title: Re: Importing building from sketchup with texture
Post by: ZeosPantera on April 18, 2013, 12:49:02 pm
Sd.Kfz.234/4  It kind of weird how  regular paint color in sketchup look really different once imported in Outerra. Like the tires are supposed to be dark gray. The textures though, look similar as in sketchup.

https://docs.google.com/file/d/0B96RrTcNJsI2NmJKQWZpOWVFdmM/edit?usp=sharing (https://docs.google.com/file/d/0B96RrTcNJsI2NmJKQWZpOWVFdmM/edit?usp=sharing)

(http://imageshack.us/a/img594/4286/sdkfz2344.jpg)

Wow.. This thing is HUGE

(http://i2.minus.com/iSYKcmc8lLC1e.jpg)

Is this a made up tank?.. NOPE The machine gun on top looks proper to scale but this is HUGE..

I also tweaked it a bit. The Center of gravity was throwing me off as I couldn't guess the scale without a comparison vehicle.

(http://www.missing-lynx.com/gallery/german/sdkfz2344sd_14.jpg)
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 18, 2013, 01:29:57 pm
Possibly the original modeler did it without checking the real dimension. Will check on a tank reference site to find out how big this thing is irl.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 18, 2013, 01:49:30 pm
Here's the specifications

Weight:   11500kg
Crew:   4 men
Engine:   Tatra 103 / 12-cylinder / 220hp
Speed:   Road: 80km/h
Cross-Country: –km/h
Range:   Road: 900km
Cross-Country: —km
Fuel Capacity:   360 litres
Lenght:   6.00m
Width:   2.40m
Height:   2.21m
Armament:   75mm PaK 40 L/46 & 7.92mm MG34/42
Ammo:   75mm – 12 rounds
Armor:   5-30mm

it is modeled at 12 meters long atm, so it is double size. Will resize it but will keep the MG the same as it look right as you say.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 18, 2013, 02:02:10 pm
look like it's a freehand kind of modeling. The profile really dont match with the real thing

(http://imageshack.us/a/img208/4203/sdkfz23442.jpg)
Title: Re: Importing building from sketchup with texture
Post by: Revolver on April 18, 2013, 02:18:54 pm
nice one...but one must still shoot him teach. ;)
Title: Re: Importing building from sketchup with texture
Post by: ZeosPantera on April 18, 2013, 02:56:39 pm
The scale matters more than the authenticity of the model. I am still waiting for implementation of other moving bits. Rotating the canons with my joystick while I wheel and pedal my way around would be sweet.
Title: Re: Importing building from sketchup with texture
Post by: M7 on April 18, 2013, 05:09:23 pm
I updated the scale to near half of what it was but kept the machine gun near the size it was orininaly. Will need some tweaks i think..

https://docs.google.com/file/d/0B96RrTcNJsI2NmJKQWZpOWVFdmM/edit?usp=sharing