News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

someone wrote a Blender Export for TestDrive 3

Started by llm, August 01, 2020, 09:27:36 PM

Previous topic - Next topic

llm


Cas

Wow!  The Blender file is great. I downloaded it and was rendering some pieces. There's a lot I still don't handle well in Blender. Like, when navigating on the space, I find it hard to move over large areas, as focus seems to stay at the same location and it's not always possible to focus on a particular object, like when the object is large. Also, I can see that this renders super fast even in Cycles, and does not produce noise, which means the person who did this knows how to optimise the engine when some things are more important to render than others, like in this case, no complex textures. I want to learn to do that well and rendering a Stunts track in motion should be easier than with Test Drive

Blender supports many formats. I've been researching on several of them. I'm already comfortable OBJ, which was what Duplode first suggested to me. It is powerful and simple and does not get too large even though it's text because materials are stored once and descriptors are usually one or two letters long (like "v" to define a vertex). Still, I'm always a fan of binary formats because they're so much easier to parse and most of the time, you won't be editing your model by writing text, but rather, you'll be going between the 3D editing program and the game renderer. I did take a look at x3d. It's good that these formats exist, because in some cases, you may want to just touch something specific and you can use a general xml parser. For my engine, I'll be using a dedicated binary format and I'll write a little program to convert between it and OBJ so I can communicate with Blender.

My original idea is to use plainly coloured triangles, the same as with Stunts, but I've been thinking I could also add the option of dynamic shading, meaning that, instead of having to define the colour for each triangle of, say, a car, you can say all these triangles are "blue" and then, they will be coloured on the fly depending on their orientation.
Earth is my country. Science is my religion.

llm

X3d allows faces with single color - something that seem not possible with obj format and its easy to generate

Cas

Oh, but OBJ can do that too!  I mean, if it weren't so, I wouldn't have used it because that's essential for a project like mine. In OBJ, each face is defined with an "f" line and you can use "usemtl" at any point to set the current material for faces that come from that point onwards. Then, in the materials file, you can define the colour among other things. The red, green and blue components of the base colour are defined with a "Kd" line. If we're only using plain colours, that's the only line we need from materials.

Now, to name one thing that X3D does better than OBJ, I like it that, being xml-based, line ends are insignificant and everything is defined by tags. This is good because text files on different systems use different text file formats, including different end-of-line markers, so an OBJ file made in GNU will not work in Windows and vice-versa. With X3D, that problem does not exist.

Another format I liked from the ones that come for exporting by default in Blender is STL, but while it does support colour, Blender does not use this when exporting in STL, probably because it's not an "official" way of specifying face colour.
Earth is my country. Science is my religion.

llm

#5
I dont understand that GNU obj under windows problem, all that is needed is \r\n(windows), \n(linux) or \n\r(old macs?) awareness, same goes to xml

llm

#6
is the obj format capable to handle the texture stuff like the Background Image - i also got the feeling that parts of the race track pieces needs texturing - like tunnels?

llm

I've built stressed.exe from source and extracted some car models
The models seem to have holes, is that a problem - i thought that models should be closed to ease rendering?

Cas

Well, yes, if you have a text file loading routine that's aware of different line endings, it will work, but most programs don't have that. This means that you have to make a binary parsing routine for text files if you want to make sure it'll support the files. For example, FreeBasic will write text files with different line endings depending on the platform, but when reading, it will assume the line ending for your OS, so if you're passed a file from another platform, it will not read it properly. This may have changed recently, but I don' t know, so I don't run the risk. Therefore, I create my own binary routines to read text files when I make multi-platform programs. Being able to ignore line endings makes everything pretty much simpler.

Texture would look good in triangles for a future renderer. I first want to do this with plain colours, because I don't want to add an extra problem to my project right now, but eventually, I'd like to add texture. I've been thinking that, if I want to add textures in the future, I'd first switch from a triangle-based renderer to a quad-based one. It's much easier for UV texture mapping.

Hey, I've been trying to build stressed from source and always have problems. Did you build it for GNU?  My problem is that it requires qmake and when I try to install Qt development, it turns out it's no simple task and I get lost. How did you get this done?  Or does your GNU distribution already have it installed?
Earth is my country. Science is my religion.

llm

#9
Quote from: Cas on August 04, 2020, 01:19:05 AM
Well, yes, if you have a text file loading routine that's aware of different line endings, it will work, but most programs don't have that. This means that you have to make a binary parsing routine for text files if you want to make sure it'll support the files. For example, FreeBasic will write text files with different line endings depending on the platform, but when reading, it will assume the line ending for your OS, so if you're passed a file from another platform, it will not read it properly. This may have changed recently, but I don' t know, so I don't run the risk. Therefore, I create my own binary routines to read text files when I make multi-platform programs. Being able to ignore line endings makes everything pretty much simpler.

i work multiplatform on daily basis and never real got problems with that - but maybe im just pampered with enough helper code :)

Quote from: Cas on August 04, 2020, 01:19:05 AM
Hey, I've been trying to build stressed from source and always have problems. Did you build it for GNU?  My problem is that it requires qmake and when I try to install Qt development, it turns out it's no simple task and I get lost. How did you get this done?  Or does your GNU distribution already have it installed?

its was my first time i build stressed at all, using VS2019 and Qt 5.15 (currently latest) under Win7/x64 - that needed changes to get it working - i think dstien uses the windows ports of gnu tools like mingw or something

i've installed VS2019 community (want to try the new compiler for fun), installed Qt 5.15 using the Qt maintainance tool (no interest in building Qt myself for hours), git clone the source, runned qmake in the folder, then nmake (fix some problems: https://github.com/dstien/gameformats/pull/1) all in all and around 20min later i was able to use a freshly build stressed :)

i think it works out of the box under linux (because its dstien default environement) - just install qt and build tools, git clone source, qmake - i think its stright forward - but never tested it

Cas

Ah!  I'm afraid it is not so, ha, ha. I'm using GNU/Linux and I've had a hard time trying to build Stressed more than once. First two times, Duplode in the end did it for me. I failed in Xubuntu, then in Kubuntu and now I'm on Mint and I still can't do it.
Earth is my country. Science is my religion.

llm

need to try it myself - but im familiar with all the needed tools :)

llm

HowTo:

  • VM with fresh Ubuntu 20.04 LTS (Minimal Installation)
  • sudo apt update
  • sudo apt upgrade
  • sudo apt install build-essential # for gcc
  • sudo apt install mesa-common-dev # for opengl
  • sudo apt install qt5-default
  • sudo apt install git
  • git clone https://github.com/dstien/gameformats.git
  • cd gameformats/stunts/stressed
  • qmake
  • make
  • ./src/app/stressed

worked on first try - ~30min

maybe u missed some packages?

Cas

In reality, my biggest problem was that I didn't know the names of the packages, how to find out which dependencies there were, what they were called, where to get them from, etc.

Now, Mint is quite similar to Ubuntu, so I expected it would work to just copy your steps... and it probably would, but I stopped at the apt upgrade and pulled out a list of what would be upgraded. Tons of things that don't need to be upgraded, including the VLC player. I have a philosophy of "If it ain't broke, don't upgrade it", ha, ha... so I thought I'd first try without that step. Apt reported I already had the newest version of Build essential and Mesa. Qt5 installed like charm. Git was already installed and it cloned well. Qmake, good. When I tried to make, a file requested by the source was not found so it failed. It was a header file, I think. So well, probably I do have to upgrade something, but I don't want to upgrade every pending package. How can I find out what needs to be upgraded and do it selectively?  And once I get everything to run, is there a way I can make myself portable binaries?  That is, a copy-and-run package.
Earth is my country. Science is my religion.

llm

#14
Strange, stressed is a very clean, simple - minimal dependencies program

Quote
How can I find out what needs to be upgraded and do it selectively?  And once I get everything to run, is there a way I can make myself portable binaries?

you can build all libs statical - will get you a huge executable or hope that other system got the needed dependencies, its not that easy under Linux - and the huge mass of little differences between the distros, much more easy under windows

QuoteWhen I tried to make, a file requested by the source was not found so it failed.
Post the exact error message, its always the best you can do