[solved] Model appears shorter than expected

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
7Soul
Posts: 44
Joined: Sat Mar 13, 2021 6:47 pm

[solved] Model appears shorter than expected

Post by 7Soul »



On the left a 64x64 sector, on the right a 64x64 Cube model. This is how it appears bot in UDB and GZDoom

Modeldef:

Code: Select all

Model TestBox {
   Path "models"
   Model 0 "test_box.obj"
   Path "sprites/environment"
   SurfaceSkin 0 0 "EVPLA0.png"
   Scale 1 1 1

   FrameIndex EVPL A 0 0
}
Actor definition:

Code: Select all

Class TestBox : Actor {
	Default {
		//$Category Decoration
		Radius 32;
		Height 64;
	}
	States {
	Spawn:
		EVPL A 1;
		Wait;
	}
}
.obj definition
Spoiler:
Last edited by 7Soul on Thu Jul 13, 2023 5:22 pm, edited 1 time in total.
GalaxyStranger01
Posts: 8
Joined: Wed May 31, 2023 7:19 pm
Operating System Version (Optional): Windows, Linux

Re: Model appears shorter than expected

Post by GalaxyStranger01 »

Unless I'm wrong, it looks it's just rendering it as the engine wants. Did you measure out 64 units in your modeling software? If so, I don't think it's gonna line up.

What I do is make a model based on the sprite dimensions - whatever they may be. Then, like the sprites, it renders the model as expected because the difference has already been taken into account. My SIZE may be off, but the dimensions will be correct.

So you can either do that with the box texture and model to it, or change the scale in the definition.

Like I said, I could be wrong, but that's what it looks like to me.
7Soul
Posts: 44
Joined: Sat Mar 13, 2021 6:47 pm

Re: Model appears shorter than expected

Post by 7Soul »

GalaxyStranger01 wrote: Thu Jul 13, 2023 11:29 am Unless I'm wrong, it looks it's just rendering it as the engine wants. Did you measure out 64 units in your modeling software? If so, I don't think it's gonna line up.
The box is 1m³ in Blender, then exported at 32 times the size. The x and y sizes appear correct, taking a 64x64 units space, but the z size is shorter

GalaxyStranger01 wrote: Thu Jul 13, 2023 11:29 am So you can either do that with the box texture and model to it, or change the scale in the definition.
That can be done, but it would be easier if it just rendered at the same size as I see it in Blender to begin with
User avatar
Xeotroid
Posts: 446
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Model appears shorter than expected

Post by Xeotroid »

The world itself (map geometry and sprites) is rendered stretched by 20% as part of the aspect ratio correction. 3D models aren't affected by this, so they are rendered the same way as you see them in Blender. If you're using models that need to fit level geometry, either account for that when making them, or use Scale 1.0 1.0 1.2 in MODELDEF.
7Soul
Posts: 44
Joined: Sat Mar 13, 2021 6:47 pm

Re: Model appears shorter than expected

Post by 7Soul »

Xeotroid wrote: Thu Jul 13, 2023 11:53 am The world itself (map geometry and sprites) is rendered stretched by 20% as part of the aspect ratio correction. 3D models aren't affected by this, so they are rendered the same way as you see them in Blender. If you're using models that need to fit level geometry, either account for that when making them, or use Scale 1.0 1.0 1.2 in MODELDEF.
Thank you for the link, I changed the pixelratio to 1 and it was enough to get the models to render properly (only in UDB they still appear shorter)
User avatar
Xeotroid
Posts: 446
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Model appears shorter than expected

Post by Xeotroid »

In UDB preferences, on the Appearance tab, untick the "Stretched view in visual modes" option, that should fix it. I haven't checked how it works, though, and the tooltip says it stretches the geometry and sprites by 15%, not 20%. I assume that's just an error in the tooltip, as otherwise models that are pre-corrected to the default stretch level would be too tall for me.

Do note that when changing the pixelratio value, it obviously causes things made with the stretching in mind squashed (see examples here), so I personally wouldn't recommend it unless your mod/game has all custom graphics made with regular square pixels in mind. In that case, it makes stuff easier (especially since making pixel art in Photoshop with ARC is a supreme pain in the ass).
7Soul
Posts: 44
Joined: Sat Mar 13, 2021 6:47 pm

Re: Model appears shorter than expected

Post by 7Soul »

Xeotroid wrote: Thu Jul 13, 2023 1:32 pm In UDB preferences, on the Appearance tab, untick the "Stretched view in visual modes" option, that should fix it. I haven't checked how it works, though, and the tooltip says it stretches the geometry and sprites by 15%, not 20%. I assume that's just an error in the tooltip, as otherwise models that are pre-corrected to the default stretch level would be too tall for me.

Do note that when changing the pixelratio value, it obviously causes things made with the stretching in mind squashed (see examples here), so I personally wouldn't recommend it unless your mod/game has all custom graphics made with regular square pixels in mind. In that case, it makes stuff easier (especially since making pixel art in Photoshop with ARC is a supreme pain in the ass).
Yeah it's a TC, and thanks for the tips
Post Reply

Return to “Assets (and other stuff)”