Obj files? Will I need to create Dat2ObjTexNorm.py?

Information, contacts and source code for ports to Linux, Windows, etc.

Moderators: winston, another_commander

Post Reply
SarahC
Poor
Poor
Posts: 5
Joined: Wed Oct 25, 2017 2:16 am

Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by SarahC » Wed Oct 25, 2017 2:29 am

Hi everyone!

I've made a little webpage page that spins some classic ships around, all in software:
https://codepen.io/SarahC/pen/QqobmO

And a super naive converter (it just scans for keywords, and stops at brackets) for VRML 2 to JavaScript ship declarations:
https://codepen.io/SarahC/pen/yzZKWN
https://codepen.io/SarahC/pen/pWYJKV


I've had a go at converting the Dat files in Oolite to Obj files, using Dat2ObjTex.py ((C) Giles Williams 2005)
The results so far are ok,
https://codepen.io/SarahC/pen/PJvzRm?editors=0010

But that Python code only handles simple ships, and one texture... it fails for the more complex Dat files. =(

Are there Obj/Texture files out there for the standard Oolite ships?
Or does someone have a reverse version of Obj2DatTexNormal.py?

I was aiming of a sandboxed Chrome fullscreen instance, with the WebGL page showing the ships zooming in and out, as a screensaver for Windows. Saves me tackling SlickDX in Visual Studio!

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5394
Joined: Wed Feb 28, 2007 7:54 am

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by another_commander » Wed Oct 25, 2017 9:00 am

Hi and welcome!
Are there Obj/Texture files out there for the standard Oolite ships?
Yes there are. Object files for all the new models can be found in the oolite-assets repository on github. Follow this link: https://github.com/OoliteProject/oolite ... t-1.80-obj
The corresponding textures are the same ones that can be found in the Resources/Textures folder of your Oolite distribution.

As for a converter utility, I don't think that there is anything maintained today beyond Ob2DatTexNormal.py. But hopefully the object files will be sufficient to achieve what you want.

SarahC
Poor
Poor
Posts: 5
Joined: Wed Oct 25, 2017 2:16 am

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by SarahC » Wed Oct 25, 2017 9:30 am

another_commander wrote:
Wed Oct 25, 2017 9:00 am
Hi and welcome!
Hiyah!

Thanks for the link - perfect, just what I needed.

The Cobra - Mark 3 diffuse.png file seems to be multi layered... I open it in photoshop and there's just a very subtle black and white shading texture, with none of the hull's green and blue to be seen!

I think it's a special PNG because several programs can't handle it: https://imgur.com/a/QVNuC

Do you know anything about it? I may have got the wrong end of the stick.

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5394
Joined: Wed Feb 28, 2007 7:54 am

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by another_commander » Wed Oct 25, 2017 9:53 am

SarahC wrote:
Wed Oct 25, 2017 9:30 am
The Cobra - Mark 3 diffuse.png file seems to be multi layered... I open it in photoshop and there's just a very subtle black and white shading texture, with none of the hull's green and blue to be seen!

I think it's a special PNG because several programs can't handle it: https://imgur.com/a/QVNuC

Do you know anything about it? I may have got the wrong end of the stick.
All textures in the post-1.80 models look similar. The reason is that the emission map is embedded in the png's alpha channel. You will need an image processing program capable of separating a texture's individual channels in order to view it porperly.

SarahC
Poor
Poor
Posts: 5
Joined: Wed Oct 25, 2017 2:16 am

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by SarahC » Wed Oct 25, 2017 11:40 am

another_commander wrote:
Wed Oct 25, 2017 9:53 am
All textures in the post-1.80 models look similar. The reason is that the emission map is embedded in the png's alpha channel. You will need an image processing program capable of separating a texture's individual channels in order to view it porperly.
I see, thanks!

It's hidden away in Photoshop - selecting the "Channels" window shows the RGB channels AFTER the transparency has been applied, we want it BEFORE.

To do this:

Select the layer, then go to Layer menu -> Layer Mask -> From Transparency.

The alpha channel is extracted into a greyscale mask attached to the diffuse layer, which is now an opaque RGB layer.
To see the opaque layer on its own - disable the mask layer.

To see the mask as an "Emission" layer, holding left Alt key, and clicking the greyscale alpha mask layer that is linked to the diffuse layer will show only the alpha channel - the emissive parts in white.

SarahC
Poor
Poor
Posts: 5
Joined: Wed Oct 25, 2017 2:16 am

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by SarahC » Fri Oct 27, 2017 1:36 am

Sorted!

Thanks for your help.

https://codepen.io/SarahC/pen/PJvzRm

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6310
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by Diziet Sma » Fri Oct 27, 2017 2:04 am

SarahC wrote:
Fri Oct 27, 2017 1:36 am
https://codepen.io/SarahC/pen/PJvzRm

Looks good! Took me a moment to realise it was mouse-interactive, though.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied

SarahC
Poor
Poor
Posts: 5
Joined: Wed Oct 25, 2017 2:16 am

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by SarahC » Fri Oct 27, 2017 3:08 am

Next stop - online OOLite!

The source already has the ship AI in JavaScript too!

User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 1872
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by maik » Sat Oct 28, 2017 9:31 pm

Hello and welcome! Grondilu started a WebGL effort as well, you might want to get in touch. Also, the “Porting to other platforms” forum is a better place for this.

Looking forward to seeing more of your work!

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5394
Joined: Wed Feb 28, 2007 7:54 am

Re: Obj files? Will I need to create Dat2ObjTexNorm.py?

Post by another_commander » Sun Oct 29, 2017 9:05 am

Topic moved to Porting to Other Platforms.

Post Reply