Ship scaling issue when modding

Post bug reports and ask for support here.

Moderators: Icemania, elliotg

User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

Small discovery here.

This time I made the Borg Cube 100x100 and made a large border around it about 25 pixels wide, so the opaque pixels only fill about 50% of the image. Notice how the Borg Cube is bigger this time, but poor quality.

Again the Borg is a cruiser of size 298, the frigate is 150.



Image
Attachments
borgtest2.jpg
borgtest2.jpg (206.35 KiB) Viewed 278 times
User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

I added some 10x10 pixel dots to the corners of the canvas and here's the result. Canvas size is 500x500 and the cube is about 250 pixels across.

Notice the cube has remained about the same size, but it's triangle indicator's size has been increased because the game thinks that the ship is larger than it actually is. In retrospect, I should have made the points a colour other than black so that you could see them, but if you look closely at the bottom of the triangle, you can see one of them.

Image
Attachments
borgtest3.jpg
borgtest3.jpg (173.76 KiB) Viewed 277 times
User avatar
lordxorn
Posts: 768
Joined: Sun Dec 06, 2009 6:18 am

RE: Ship scaling issue when modding

Post by lordxorn »

Very interesting, now if you filled the space between the borg cube and that black speck I can see on the bottom left of the triangle shouldn't it in theory big bigger then?
User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

Hmmm..

Actually, if I were to fill that space, I think it would make it smaller. Testing now.
User avatar
elliotg
Posts: 3983
Joined: Mon Sep 10, 2007 9:32 am

RE: Ship scaling issue when modding

Post by elliotg »

ORIGINAL: lordxorn

Here is an image to help illustrate our point Elliot.

My ship sizes here were
Escort (Gunboat) 70
Frigate (Assault Frigate) 250
Destroyer (Nebulon B)500
Cruiser (Mon Calamari Cruiser)750
Capital (Home One) 1100

The Nebulon is larger than the Mon Calamari Cruiser, so according to your explanation if I increase the canvas size around the nebulon it should scale better? Also note that Home One capital ship is not much larger at 1100 size.
Wow, I love those ships lordxorn! Have to get me some of those... [:)]

I'll try and explain this better: when DW loads the ship image files, it measures the number of non-transparent pixels so that it can properly compare different ship images and scale them appropriately in the game, so that their sizes relative to each other are correct.

The single determining factor in how large a ship is drawn in the game is the size of the ship itself - i.e. the size of the design, determined by which components are in the design.

In the game ships and bases are always drawn in the correct relative size scale in relation to each other. Thus a ship of size 1000 will be drawn twice as big as a ship of size 500. The size of the image used to draw the ship is irrelevant to how big the ship is drawn.

But the way that ship images are measured (so that they can be drawn at the proper scale) is by comparing the total number of non-transparent pixels in the image to the overall size of the image. Thus an image of 100 x 100 pixels with a long skinny ship drawn on it, might have 2000 non-transparent pixels on it's total area of 10000 pixels - thus a coverage of 20%. So when a ship using this image is drawn it will likely be scaled up in size relative to another ship image that might have 50% coverage.

So, if you look at the (very beautiful :) ) Nebulon B destroyer in your picture, it is about 2/3 the size of the Mon Calamari cruiser - i.e. it is scaled correctly (500/750). But because of the shape of the Nebulon B (long and skinny), it is longer than the Mon Calamari.

Hope that all makes sense [:)]
User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

I think I understand, Elliot. This is how we can add images that are 500x500 and still see them scale accurately against the vanilla ship images of 200x200.

That's very useful, but it does present us with this problem when modding either long, slender ships or round, square ships.

Lordxorn, here's the result of my test. 500x500 image, the cube is approx. 250x250. I added 10x10 dots (green) and filled the rest blue. You can see that it makes the cube even smaller, the blue background is now the size that the cube was and the triangle is much smaller. This is because there are no transparent pixels.

Image
Attachments
borgtest4.jpg
borgtest4.jpg (163.58 KiB) Viewed 277 times
User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

Next, I'm going to try making the blue background slightly transparent...

No real change, so partially transparent pixels are treated the same as opaque ones.



Image
Attachments
borgtest 5.jpg
borgtest 5.jpg (181.74 KiB) Viewed 277 times
User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

Lordxorn, I think if you tried the above method, only obviously use black instead of blue, it might make the Nebulon destroyer smaller.

EDIT: Of course the side effect would be that some of the stars and other ships around the Nebulon would fade slightly.
User avatar
lordxorn
Posts: 768
Joined: Sun Dec 06, 2009 6:18 am

RE: Ship scaling issue when modding

Post by lordxorn »

Elliot thanks for the extra help, I know Igard and I are beating this into the ground!! LOL.

Igard great test, I was about to give until I saw Elliot's post and your test. Maybe if I just fill out some extra opaque pixels on the nebulon to trick the engine into thinking it is as fat as the other ships it should work like your excellent images illustration.

Yeah I prefer the ships at 500x500 because they keep their detail when they are larger, I can run performance test later.

The only problem with this fix Igard is the cool looking ship damage effects might be off the model as well.

Ok your suggestion and Elliot's detailed explanation worked I just have to tweak the pixels so they are less apparent and resize the Homeone (made it fatter in a internal test).

The easy fix for long skinny ships is to just simply create a layer under the acutal ship layer and set that layer's opacity to %12. I found that the pixels were barely visible.

How can this help your borg cube out now?
Image
User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

Thanks for the explanation, Elliot. I much prefer having the ability to add different size ship images without worrying about scaling. It's a great feature, just a shame about this side-effect.

Lordxorn, I think you can make the colour almost completely transparent, so much so, that you'll hardly notice the stars fading behind it. You're right though, the damage effect will look odd, maybe it'll be like debris floating around the ship?

I don't think there's a way to scale the Borg cube to look bigger. Looks like the Distant Worlds Galaxy will be free from fear of assimilation, at least for the time being. [:D]

I'm not sure if the game can properly depict the Borg yet anyway as a race of cyborgs who don't colonise or trade or involve themselves with diplomacy.

So I'm content to wait until there's some kind of mod feature for creating massive ships. Like I said in an above post, there must be some races that are larger physically than humans, so would need more head room in there ships, hence bigger ship's hulls. It's on the modders wishlist anyway. [:)]
User avatar
elliotg
Posts: 3983
Joined: Mon Sep 10, 2007 9:32 am

RE: Ship scaling issue when modding

Post by elliotg »

I might be able to add something to allow some kind of special-case scaling for some images (sometime in the future... [:)]). The overall intent of the current system was so that all ships and bases automatically scale in size relative to each other.

One point to keep in mind if you use a lot of alpha transparency in your ship images: this will hurt performance - maybe not too much, but something to keep in mind.
User avatar
Igard
Posts: 2282
Joined: Mon Mar 29, 2010 2:43 am
Location: Scotland

RE: Ship scaling issue when modding

Post by Igard »

Thanks Elliot. If it could be done on a ship by ship basis, that would be ideal, but if it's easier to add some kind of racial size setting, that would work fine too.

I'm happy to wait, I don't want to hold up the progress of the mod support patch and I've got plenty more Trek races to add in the mean-time. [;)]
Post Reply

Return to “Tech Support”