Stunts Forum

ZakStunts - the Competition => Competition and Website => Topic started by: Duplode on January 19, 2024, 04:16:46 AM

Title: Side pictures of cars
Post by: Duplode on January 19, 2024, 04:16:46 AM
I have worked out a recipe for making scoreboard side pictures of cars with consistent looks and angles. While not as sleek or convenient as a special purpose tool (https://forum.stunts.hu/index.php?topic=4187.0) would be, it is quick enough to do that even a large handful of pictures can be prepared painlessly. The secret sauce is tweaking Stressed so that the default viewing angle is the one we want to use (more on that at the end). I've gone ahead and updated the pictures on the site, so let me know how you like it after a hard refresh -- while consistency requires a few compromises, there might be some room for adjusting the values in the recipe.

So, without further ado, here are the steps:




Below are the the tweaks in the Stressed code (https://github.com/dstien/gameformats/tree/master/stunts/stressed/src). I picked 10° as the roll angle because that felt like a typical value for the old pics; 15° is an alternative value that might work as well. You'll note I have also changed the y-axis aspect ratio correction factor in the rendering from 0.8 to a more accurate 0.8333... (that's something I probably should make into an actual patch for Stressed). Note that the line numbers in this diff don't necessarily match the current state of the Stressed repository:

diff --git a/stunts/stressed/src/shape/shapeview.cpp b/stunts/stressed/src/shape/shapeview.cpp
index a92c31f..b4ecfb6 100644
--- a/stunts/stressed/src/shape/shapeview.cpp
+++ b/stunts/stressed/src/shape/shapeview.cpp
@@ -135,7 +137,8 @@ void ShapeView::reset()
         0.0f,
         0.0f,
         -distance(VerticesModel::toInternal(bound[2]), VerticesModel::toInternal(bound[5])));
-    m_rotation.rotate(10.0f, 1.0f, 0.0f, 0.0f);
+    m_rotation.rotate(-90.0f, 0.0f, 1.0f, 0.0f);
+    m_rotation.rotate(-10.0f, 0.0f, 0.0f, 1.0f);
   }
 
   QAbstractItemView::reset();
diff --git a/stunts/stressed/src/shape/verticesmodel.cpp b/stunts/stressed/src/shape/verticesmodel.cpp
index f9b7db0..0877e58 100644
--- a/stunts/stressed/src/shape/verticesmodel.cpp
+++ b/stunts/stressed/src/shape/verticesmodel.cpp
@@ -21,7 +21,7 @@
 const int VerticesModel::VAL_MIN;
 const int VerticesModel::VAL_MAX;
 
-const float VerticesModel::Y_RATIO = 0.8f;
+const float VerticesModel::Y_RATIO = 5.0f / 6.0f;
 
 bool VerticesModel::m_weld = false;

Title: Re: Side pictures of cars
Post by: Cas on January 19, 2024, 06:20:19 PM
It's very timely that you're posting these ideas now, because I've started working on a procedure to auto-generate car images from 3SH files yesterday. My idea is to use that as part of a new garage program, a more visual one. I could follow your guidelines to make both looks compatible with each other. I still haven't done what Dreadnaut suggested (the SVG idea), but I could use the same code to produce that.
Title: Re: Side pictures of cars
Post by: Duplode on January 20, 2024, 12:09:06 AM
Quote from: Cas on January 19, 2024, 06:20:19 PMIt's very timely that you're posting these ideas now, because I've started working on a procedure to auto-generate car images from 3SH files yesterday.

Very nice! The parameters I described above are very much dependent on the use case, and it may make sense for them to be configurable. (For instance, while raising the maximum height somewhat could be helpful, in this case I didn't try that because it would affect layout all over the site.)
Title: Re: Side pictures of cars
Post by: Cas on January 20, 2024, 07:09:24 PM
Right. The situation with cars that are a lot bigger than most complicates the thing a little bit. If they are scaled differently, they look weird in the scoreboard, but if they are all scaled the same, the majority of cars will look very small
Title: Re: Side pictures of cars
Post by: dreadnaut on January 21, 2024, 01:50:46 PM
Thank you Duplode, that's a smooth new set of side pictures. The tall vs long car size difference will probably remain, not much we can do there. The Monster Truck might look tiny ;D
Title: Re: Side pictures of cars
Post by: Overdrijf on February 05, 2024, 11:12:36 PM
Addition: For white cars the selection of the white background doesn't work. So there the trick is that you make the exact same screenshot ofa non-white paintjob, and have both in the same image as different layers. Use the non-white paintjob for the selection, and apply the transparancy on the white one.
Title: Re: Side pictures of cars
Post by: Cas on February 06, 2024, 12:58:06 AM
Wasn't the white in Stunts palette #fcfcfc while the background in Stressed is #ffffff?