[solved] (graphics) What am I doing wrong?

Place to get help with not working mods / modding interface.
Post Reply
Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

[solved] (graphics) What am I doing wrong?

Post by Kingdud »

I'm trying to make graphics for my mod. I have 0 artistic or 3D modeling skill. The .blend file attached to this post (
lwr.zip
Blender .blend file for the LWR object.
(339.26 KiB) Downloaded 42 times
) is the culmination of around 10 hours of fiddling between blender, Gimp, and Factorio to try and get the entity to render correctly.

The short version is, in Blender, I created the reactor layout such that the perimeter fence is 20m x 40m. I then defined the entity within the mod as being 40x80 in-game grid units (so, 40x80m). This is mostly because i was dumb and forgot that -20 to +20 is 40 units, not 20. But, whatever, it's still *technically* too small for the power output, but given that the power density of solar is ~36x higher than it should be, if my nuclear setup is 1.5x more dense than it should be I'm really not going be upset.

My issue comes when I use the .pngs I export via rendering from Blender in Factorio. Even once I use shifts and the scale paramter the artwork doesn't fit in the entity box in game. It's too narrow.
See red lines; that's the gap I'm talking about.
See red lines; that's the gap I'm talking about.
annoying.png (978.34 KiB) Viewed 1095 times
I don't understand why. I've tried fiddling with various parameters and I can't make it work. There is something fundamental I am not understanding between how Blender is rendering the image and how Factorio is displaying it. Can anyone educate me? What am I missing? Ideally, I'd want to be able to export from Blender, crop, and use the art asset directly in game with as little tweaking as possible. I really don't want to spend hours and hours figuring out shifts (I know cGFXShift exists, it doesn't work with images this large), scaling numbers, and everything else. This just kills me. What am I missing? There has to be a better way, with less tweaking, and more accuracy, to do this.

edit: If you want the entire mod, it's still a work in progress, but all the files/art are here: https://github.com/Kingdud/Factorio-Mod ... ance_1.0.0
Last edited by Kingdud on Thu Jan 02, 2020 4:59 am, edited 1 time in total.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: (graphics) What am I doing wrong?

Post by eradicator »

Because when you project a square viewed from a 45° angle onto a flat surface it's no longer a square. In blender you set the *footprint* to x*y, but the factorio tile grid represents the entity size after 45° projection (i.e. the tile grid is drawn "onto the screen" not "onto the floor". You're basically comparing apples and oranges. As a rough estimation if you want a 10x10 entity, you have to set the blender footprint to 10x14 It's a quirk of the engine that's been in several FFFs, there's no way around it except redesigning your graphic to fit the collision box, or resizing the collision box to fit the graphic.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

Re: (graphics) What am I doing wrong?

Post by Kingdud »

Ok. That at least makes sense (unlike my other theories). Is there a better solution than just scaling everything 40% in one axis? Obviously I can't do that to the cooling towers, because then they wouldn't be circular anymore. But I can do it to everything else without too much of a problem.

Also, thanks so much for the ballpark number. So helpful. I'd be pulling my hair out (more than I am...) without that. So thanks!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: (graphics) What am I doing wrong?

Post by eradicator »

Kingdud wrote:
Thu Jan 02, 2020 1:52 am
Is there a better solution than just scaling everything 40% in one axis?
No, this is exactly the reason why there are almost no mods with very large structures. But you don't need to scale, you can just add some spacing here and there, some floor decoration maybe. Be creative. Also the 40% is from memory, and that memory is somewhat old. Easiest way to check is to create a grid in blender and rotate it so that it's right in front of the camera. Then you can use the camera view to see how it'll look in-game.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

Re: (graphics) What am I doing wrong?

Post by Kingdud »

Solid plan (the grid). Thanks. I'm good with racks of server equipment, not art. >.<

Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

Re: (graphics) What am I doing wrong?

Post by Kingdud »

So I used the grid method and it said 20 meters was actually 28 (so 40%) but when I scaled the art by 40%, I got something 10% too large. So apparently it's 30% and I suck at counting or...something. Regardless, 30% is the offset. I can live with that. This problem also got me to figure out how to make shadows and non-shadow art, so I'll have to redo the MSR reactor rendering, but it will look better because of it. Onward and upward!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [solved] (graphics) What am I doing wrong?

Post by eradicator »

Found the old FFF 133
FFF 133 wrote: The game uses an dimetric projection at an angle of 45 degrees. This means that the top down view of the Factorio tile is actually a rectangle with a dimensions of 1 by 1.414 (square root of 2 ).
So if you end up with 1.3 you're not using the native 45° angle, should probably fix that to fit in with other entitites.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Kingdud
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Sat Dec 16, 2017 3:23 am
Contact:

Re: [solved] (graphics) What am I doing wrong?

Post by Kingdud »

I sat and thought about it. The fence itself is 2 meters high. On the south edge I use the bottom of the fence as the 'starting' location. At the north edge I use the top of the fence. The extra 2 meters is the height of the fence itself, and that's the extra 10%.

Post Reply

Return to “Modding help”