It is currently Sun Dec 17, 2017 6:33 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject: Re: 3DSimED 3.1j
PostPosted: Thu Aug 03, 2017 7:01 am 
Offline
Tirechanger
Tirechanger

Joined: Fri Nov 23, 2012 10:27 pm
Posts: 17
Thanks again Dave.

Any chance you could add scale/offset etc to channels 4 - 7?


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Thu Aug 03, 2017 12:02 pm 
Offline
Tirechanger
Tirechanger

Joined: Tue Oct 04, 2016 3:44 pm
Posts: 16
Thanks Dave, the Fiat 8V Supersonic now exports to FBX without issues; Wheels and brakes look better too :thumbsup:

You've already lavished plenty of attention on the FH3 models (thank-you), but if you are interested I have some C# code for resizing the generic FH3 tire meshes to a given tire spec e.g. 255/45-17. It's intended for the Unity environment but it should be easy to understand/port. The open question is how/where it would get the tire size info for a given vehicle as I don't know if that's accessible in FH3 metadata


Attachments:
185_70_13.png
185_70_13.png [ 386.27 KiB | Viewed 457 times ]
255_45_17.png
255_45_17.png [ 471.44 KiB | Viewed 457 times ]
Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Fri Aug 04, 2017 12:07 pm 
Offline
US Pits Crew
US Pits Crew

Joined: Thu Sep 01, 2005 9:58 am
Posts: 1299
Location: Barnet, London
Sorry, but no. There are only 4 texture coordinate channels and I don't think many games use more coordinate channels even if the shaders use more than 4 texture maps.

Cheers!

Dave N.

Nibiru wrote:
Thanks again Dave.


Any chance you could add scale/offset etc to channels 4 - 7?


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Fri Aug 04, 2017 1:57 pm 
Offline
US Pits Crew
US Pits Crew

Joined: Thu Sep 01, 2005 9:58 am
Posts: 1299
Location: Barnet, London
Sorry about this one but is now fixed and will be in the next release.

Cheers!

Dave N.

sderenno wrote:
hello Dave, i think there's a bug in 3.1j version, MIRROR shader for rFactor 2 doesn't work. In game you see the bmp texture.

Thanks


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Fri Aug 04, 2017 2:05 pm 
Offline
US Pits Crew
US Pits Crew

Joined: Thu Sep 01, 2005 9:58 am
Posts: 1299
Location: Barnet, London
I do have data for the wheel sizes of many of the cars in Horizon but not the DLC ones.

I use that data to scale the wheels but the big problem is with the tires.

3DSimED is using the same tire on every car because I cannot track down which tire model each car is using.

The tires are not the correct size because although I have the aspect ratio for the tires I don't know how to quickly rescale the vertices of the tire model to get the profile right. I am sure that there must be something in the tire models to enable FH3 to create different profile tires I cannot find that data so I'm a bit stuck.

Cheers!

Dave N.

br555 wrote:
Thanks Dave, the Fiat 8V Supersonic now exports to FBX without issues; Wheels and brakes look better too :thumbsup:

You've already lavished plenty of attention on the FH3 models (thank-you), but if you are interested I have some C# code for resizing the generic FH3 tire meshes to a given tire spec e.g. 255/45-17. It's intended for the Unity environment but it should be easy to understand/port. The open question is how/where it would get the tire size info for a given vehicle as I don't know if that's accessible in FH3 metadata


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Sat Aug 05, 2017 12:47 am 
Offline
Tirechanger
Tirechanger

Joined: Fri Nov 23, 2012 10:27 pm
Posts: 17
Maybe I'm missing something.

If I start with an object (lets say a piece of road) that has only a T1 shader and I apply the rF2 realroad shader. All the new texture slots have a scale of 0. I know that the bump uses the same channel as the Diffuse but it has no scale. Same with the mult and spec they use the same channel but you need to scale both textures to the same scale but cant.

Another example is if you start with an object with just a T1 mapped and you change to a bump spec map T1 the bump and spec have a scale of 0 you need to scale both the new bump and spec separately even though they all use the same channel.

Thats why I ask for channels 4 - 7 or maybe there needs to be an option on each texture slot allowing you to choose which UV channel to use.

Dave Noonan wrote:
Sorry, but no. There are only 4 texture coordinate channels and I don't think many games use more coordinate channels even if the shaders use more than 4 texture maps.

Cheers!

Dave N.

Nibiru wrote:
Thanks again Dave.


Any chance you could add scale/offset etc to channels 4 - 7?


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Sat Aug 05, 2017 2:13 pm 
Offline
US Pits Crew
US Pits Crew

Joined: Thu Sep 01, 2005 9:58 am
Posts: 1299
Location: Barnet, London
If you look in detail at the "road shader two diffuse maps" shader you will see what I mean.

Primary Texture Map -> texture coordinate channel 0
Diffuse Map T2 -> channel 1
Bump Map -> channel 0
Diffuse Map T3 -> channel 2
Specular Map -> channel 1
Diffuse Map T4 -> channel 3
Reflection Map coordinate calculated from eye position.

I don't see any scaling in the shader the coordinates are used directly.

If you have no coordinates for a channel you can copy from other channels and then multiply or add with the "Edit Texture Channel Coordinates" button on the Material Edit Pane.


Cheers

Dave N.



Nibiru wrote:
Maybe I'm missing something.

If I start with an object (lets say a piece of road) that has only a T1 shader and I apply the rF2 realroad shader. All the new texture slots have a scale of 0. I know that the bump uses the same channel as the Diffuse but it has no scale. Same with the mult and spec they use the same channel but you need to scale both textures to the same scale but cant.

Another example is if you start with an object with just a T1 mapped and you change to a bump spec map T1 the bump and spec have a scale of 0 you need to scale both the new bump and spec separately even though they all use the same channel.

Thats why I ask for channels 4 - 7 or maybe there needs to be an option on each texture slot allowing you to choose which UV channel to use.
Thanks again Dave.




Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Sat Aug 05, 2017 3:17 pm 
Offline
Jackman
Jackman

Joined: Sat Nov 15, 2014 1:39 am
Posts: 7
Dave Noonan wrote:
Sorry about this one but is now fixed and will be in the next release.

Cheers!

Dave N.

sderenno wrote:
hello Dave, i think there's a bug in 3.1j version, MIRROR shader for rFactor 2 doesn't work. In game you see the bmp texture.

Thanks

Thanks Dave


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Mon Aug 07, 2017 9:16 am 
Offline
Tirechanger
Tirechanger

Joined: Fri Nov 23, 2012 10:27 pm
Posts: 17
Sorry Dave I still don't understand call me slow or worse....I usually do most of my UV mapping in 3dsmax as it's so easy but sometimes I want to do a quick edit and use 3Dsimed.

If I bring an object into 3Dsimed that has been UVed correctly from 3dmax (eg a road that has all texture slots UVed to there respective channels) then there is no issue 3dsimed reads that.

BUT If I bring an object that has only a T1 mapping into 3dsimed and I add (create) the realroad shader then every texture slot after the original T1 has a scale of 0. The only way I see to scale the texture in the next slot is to use the scale for that texture channel or do the copy from but no options for texture slots 4 - 7.

So how do I see what the scale is of texture in slots 4 - 7 and how can I tell those slots which texture channel to use?

Sorry for my stupidity. :doh:

Dave Noonan wrote:
If you look in detail at the "road shader two diffuse maps" shader you will see what I mean.

Primary Texture Map -> texture coordinate channel 0
Diffuse Map T2 -> channel 1
Bump Map -> channel 0
Diffuse Map T3 -> channel 2
Specular Map -> channel 1
Diffuse Map T4 -> channel 3
Reflection Map coordinate calculated from eye position.

I don't see any scaling in the shader the coordinates are used directly.

If you have no coordinates for a channel you can copy from other channels and then multiply or add with the "Edit Texture Channel Coordinates" button on the Material Edit Pane.


Cheers

Dave N.



Nibiru wrote:
Maybe I'm missing something.

If I start with an object (lets say a piece of road) that has only a T1 shader and I apply the rF2 realroad shader. All the new texture slots have a scale of 0. I know that the bump uses the same channel as the Diffuse but it has no scale. Same with the mult and spec they use the same channel but you need to scale both textures to the same scale but cant.

Another example is if you start with an object with just a T1 mapped and you change to a bump spec map T1 the bump and spec have a scale of 0 you need to scale both the new bump and spec separately even though they all use the same channel.

Thats why I ask for channels 4 - 7 or maybe there needs to be an option on each texture slot allowing you to choose which UV channel to use.
Thanks again Dave.




Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Wed Aug 09, 2017 3:28 am 
Offline
US Pits Crew
US Pits Crew

Joined: Thu Sep 01, 2005 9:58 am
Posts: 1299
Location: Barnet, London
There may be 5,6,7 or 8 texture maps but a maximum of 4 texture channel coordinates are used.

Cheers

Dave N.


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Fri Aug 11, 2017 5:10 pm 
Offline
Jackman
Jackman

Joined: Sat May 13, 2017 10:21 am
Posts: 8
Hey guys, i still have a problem with my e63 amg. I tried to open a batch file Unzipfh3.bat as in the instruction, but it doesn't work. I tried to unzip it manually, made another fake game directory, but nothing helps me. My model doesn't have any tires, textures look different than they should be. I would really appreciate your support, if you can help me with importing FH3 car.
Cheers


Attachments:
Снимок экрана (115).png
Снимок экрана (115).png [ 341.42 KiB | Viewed 336 times ]
Снимок экрана (114).png
Снимок экрана (114).png [ 455.18 KiB | Viewed 336 times ]
Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Fri Aug 11, 2017 6:04 pm 
Offline
Tirechanger
Tirechanger

Joined: Tue Oct 04, 2016 3:44 pm
Posts: 16
Dave Noonan wrote:
I do have data for the wheel sizes of many of the cars in Horizon but not the DLC ones.

I use that data to scale the wheels but the big problem is with the tires.

3DSimED is using the same tire on every car because I cannot track down which tire model each car is using.

The tires are not the correct size because although I have the aspect ratio for the tires I don't know how to quickly rescale the vertices of the tire model to get the profile right. I am sure that there must be something in the tire models to enable FH3 to create different profile tires I cannot find that data so I'm a bit stuck.

Cheers!

Dave N.

br555 wrote:
Thanks Dave, the Fiat 8V Supersonic now exports to FBX without issues; Wheels and brakes look better too :thumbsup:

You've already lavished plenty of attention on the FH3 models (thank-you), but if you are interested I have some C# code for resizing the generic FH3 tire meshes to a given tire spec e.g. 255/45-17. It's intended for the Unity environment but it should be easy to understand/port. The open question is how/where it would get the tire size info for a given vehicle as I don't know if that's accessible in FH3 metadata


I can't help with the automatic tire model selection - maybe by year? I can help with re-scaling tire model vertices. I'm not sure how FH3 does it, but I'm using a brute-force approach that seems to work ok. I've also included my code for sizing the rims, as I size those according to the tire specs so everything mates properly. So far this code has worked on all FH3 tire and wheel models (the tire code even works on some non-Forza tire meshes).
I'm convinced there is a bug in Unity where imported models (e.g. fbx) come into the environment a bit larger than the import scale specifies, so you may need to adjust the global scale a bit to get the final product dimensionally accurate.
Note that I'm manually resizing the rim meshes (rims only, not tires) to 80% prior to calling the resize rim function. This is so that the spoke/hub/outer rim portion of the wheel has (approximately) the correct thickness, then the function takes over and adjusts only the inner barrel portion of the rim to accommodate different rim section widths without further distorting the hub/spoke area.
The code also laterally centers the wheel origin, which you may or may not want.

Code:
   public enum WheelSide { left, right };
   public const float RIM_LIP_WIDTH = 0.01905f;  //this constant roughly bridges the gap between a standard tire's rim bead diameter (e.g. 17" for a 255/45-17 tire) and the inner radius of an equivalent FH3 tire mesh

   protected static void FormatFH3Wheel(GameObject g, float tireSectionWidth, float wheelRimDiameter) {
      //IMPORTANT: Please note that all wheel meshes have been manually scaled to 80% size prior to this processing so we are starting with a wheel that should be 0.8 meters wide (although the code doesn't rely on that)
      //this two-stage scaling is required because the wheel hub/spokes/outer rim must be scaled down to get the desired hub/spoke depth; The global 80% pre-scaling accomplishes this
      //the inner rim portion is scaled much more drastically to accomodate varying rim section widths, which is the goal of this function
      //example usage: FormatFH3Wheel (g, 0.255f, 17f);  //will create a 17" wheel that is sized to fit a 255mm section width tire
      //note that just like real rims the actual extents of the wheel mesh (i.e. lip included) will be taller than 17" (more like 18+")
      //unlike real life rims however, our rim section widths will always be (nearly) identical to tire section width because I haven't figured out how to deform the tire sidwall profile to accommodate varying rim widths for a given tire section width
      if (g != null) {
         Mesh mesh = g.GetComponentInChildren<MeshFilter>().sharedMesh;
         int[][] triangles = new int[mesh.subMeshCount][];

         for (int i = 0; i < mesh.subMeshCount; i++) {
            triangles[i] = new int[mesh.GetTriangles(i).Length];
            triangles[i] = mesh.GetTriangles(i);                   
         }

         Vector3[] vertices = mesh.vertices;
         Vector2[] uv = mesh.uv;

         float targetRimRadius = wheelRimDiameter * Convert.inchesToMeters * 0.5f + RIM_LIP_WIDTH;
         float sourceRimRadius = GetOuterRadius (vertices);
         float targetRadiusScaleFactor = targetRimRadius / sourceRimRadius;

         //shorten the width of all verticies on the inner 10% of the rim which will narrow the rim without distorting the wheel face on the outer side
         float sourceWheelWidth = GetWheelWidth(vertices);
         float widthScaleFactor = (tireSectionWidth - 0.004f) / sourceWheelWidth;  //0.004f is to account for the outer wheel lip thickness (which we are not scaling but still makes up a small part of the total wheel width)
         float wheelCenteringOffset = tireSectionWidth * 0.5f * ((GetWheelSide (vertices) == WheelSide.left) ? -1f : 1f);   //for moving the lateral pivot point of the wheel from the outer edge to the center

         for (int i = 0; i < vertices.Length; i++) {
            if (Mathf.Abs(vertices[i].x) > sourceWheelWidth * 0.9f)
               vertices [i] = new Vector3 (vertices [i].x * widthScaleFactor, vertices [i].y, vertices [i].z);

            vertices [i] = new Vector3 (vertices [i].x + wheelCenteringOffset, vertices [i].y * targetRadiusScaleFactor, vertices [i].z * targetRadiusScaleFactor);
         }

         //done, update shared mesh
         for (int i = 0; i < mesh.subMeshCount; i++)   
            mesh.SetTriangles(triangles[i], i);
         
         mesh.vertices = vertices;
         mesh.uv = uv;
         mesh.RecalculateBounds ();
      }
   }

   protected static float GetWheelWidth(Vector3[] vertices) {
      float outerX = float.MinValue;
      float innerX = float.MaxValue;

      //width = largest x - smallest x
      for (int i = 0; i < vertices.Length; i++) {
         if (vertices[i].x > outerX)
            outerX = vertices[i].x;

         if (vertices[i].x < innerX)
            innerX = vertices[i].x;
      }

      return Mathf.Abs (outerX - innerX);
   }

   protected static WheelSide GetWheelSide(Vector3[] vertices) {
      return (float)vertices.Average (v => v.x) > 0f ? WheelSide.left : WheelSide.right;
   }

   protected void ResizeForzaHorizon3Tire(GameObject g) {
      float sectionWidth = 0f;  //mm
      float aspectRatio = 0f;
      float wheelRimDiameter = 0f;  //in
      Mesh mesh = null;
      int[][] triangles = null;
      Vector3[] vertices = null;
      Vector2[] uv = null;
      float sourceInnerRadius = 0f;
      float targetInnerRadius = 0f;
      float sourceOuterRadius = 0f;
      float targetOuterRadius = 0f;
      float sourceSectionHeight = 0f;
      float targetSectionHeight = 0f;
      float targetInnerRadiusScaleFactor = 0f;  //how much to scale the innermost sidewall to achive the desired "rim" diameter
      float innerRadiusScaleFactor = 0f;
      float sourceTireWidth = 0f;
      float tireWidthScaleFactor = 0f;
      float sidewallProfileWidthScale = 0f;
      //note that the FH3 tire meshes understandably do not model a proper rim bead as that would be a waste of polygons
      //their inner radius starts near the outer edge of the rim flange/lip such that only a tiny bit of the tire sidewall mesh is obscured by the rim mesh
      //const float RIM_LIP_WIDTH = 0.01905f;  //this constant roughly bridges the gap between a standard tire's rim bead diameter (e.g. 17" for a 255/45-17 tire) and the inner radius of an equivalent FH3 "beadless" tire mesh
      float wheelCenteringOffset = 0f;


      string[] tireParams = g.name.Split ('_');

      if (tireParams.Length != 4)
         return;

      if (!float.TryParse (tireParams [1], out sectionWidth))
         return;

      if (!float.TryParse (tireParams [2], out aspectRatio))
         return;

      if (!float.TryParse (tireParams [3], out wheelRimDiameter))
         return;

      targetSectionHeight = sectionWidth * 0.001f * aspectRatio * 0.01f - RIM_LIP_WIDTH; 
      targetOuterRadius = wheelRimDiameter * Convert.inchesToMeters * 0.5f + RIM_LIP_WIDTH + targetSectionHeight;
      targetInnerRadius = wheelRimDiameter * Convert.inchesToMeters * 0.5f + RIM_LIP_WIDTH; 

      mesh = g.GetComponent<MeshFilter>().sharedMesh;
      triangles = new int[mesh.subMeshCount][];

      for (int i = 0; i < mesh.subMeshCount; i++) {
         triangles[i] = new int[mesh.GetTriangles(i).Length];
         triangles[i] = mesh.GetTriangles(i);                   
      }


      vertices = mesh.vertices;
      uv = mesh.uv;

      sourceInnerRadius = GetInnerTireRadius (vertices);
      sourceOuterRadius = GetOuterRadius (vertices);
      sourceTireWidth = GetWheelWidth (vertices);
      wheelCenteringOffset = sectionWidth * 0.001f * 0.5f * ((GetWheelSide (vertices) == WheelSide.left) ? -1f : 1f);
      tireWidthScaleFactor = sectionWidth * 0.001f / sourceTireWidth;
      sourceSectionHeight = sourceOuterRadius - sourceInnerRadius;
      innerRadiusScaleFactor = targetInnerRadius / sourceInnerRadius;
      sidewallProfileWidthScale = sourceSectionHeight / targetSectionHeight;
      
      for (int i = 0; i < vertices.Length; i++) {
         float vertAngle = Mathf.Atan2(vertices [i].y, vertices [i].z);
         float vertLength = Mathf.Sqrt(Mathf.Pow(Mathf.Abs(vertices [i].z), 2f) + Mathf.Pow(Mathf.Abs(vertices [i].y), 2f));
         float vertSidewallScale = (vertLength - sourceInnerRadius) / sourceSectionHeight;
         float newVertLength = targetInnerRadius + (targetSectionHeight * vertSidewallScale);
         //as we squish sidewall vertically we need to flatten it horizontally in the same proportion in order to keep the same profile
         //(1f + (1f-sidewallProfileWidthScale)) term is to restore the desired section width after adjusting the profile (we need to apply this only to the sidewall verts and not the tread)
         vertices [i] = new Vector3 (vertices [i].x * tireWidthScaleFactor + wheelCenteringOffset, Mathf.Sin (vertAngle) * newVertLength, Mathf.Cos (vertAngle) * newVertLength);
      }

      //done, now update mesh
      for (int i = 0; i < mesh.subMeshCount; i++)   {
         mesh.SetTriangles(triangles[i], i);
      }

      mesh.vertices = vertices;
      mesh.uv = uv;
      mesh.RecalculateNormals ();
      mesh.RecalculateBounds ();

   }

   protected static float GetInnerTireRadius(Vector3[] vertices) {
      float innerRadius = float.MaxValue;

      for (int i = 0; i < vertices.Length; i++) {
         float vertLength = Mathf.Sqrt(Mathf.Pow(Mathf.Abs(vertices [i].z) - 0, 2) + Mathf.Pow(Mathf.Abs(vertices [i].y) - 0, 2));

         if (vertLength < innerRadius)
            innerRadius = vertLength;
      }

      return innerRadius;
   }

   protected static float GetOuterRadius(Vector3[] vertices) {
      float outerRadius = 0f;

      for (int i = 0; i < vertices.Length; i++) {
         float vertLength = Mathf.Sqrt(Mathf.Pow(Mathf.Abs(vertices [i].z) - 0, 2) + Mathf.Pow(Mathf.Abs(vertices [i].y) - 0, 2));

         if (vertLength > outerRadius)
            outerRadius = vertLength;
      }

      return outerRadius;
   }


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Sat Aug 12, 2017 7:09 am 
Offline
Jackman
Jackman

Joined: Sun May 14, 2017 10:56 am
Posts: 12
The Bentley Bentayga has misplaced vertices on the doorJamb**_a__SLOD.
Image
Image


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Sun Aug 13, 2017 6:56 am 
Offline
US Pits Crew
US Pits Crew

Joined: Thu Sep 01, 2005 9:58 am
Posts: 1299
Location: Barnet, London
Thanks for the report, this has been fixed and will be in the next release of the Forza Apex/Horizon Import plugin.

Cheers

Dave N.

Minime89 wrote:
The Bentley Bentayga has misplaced vertices on the doorJamb**_a__SLOD.


Top
 Profile  
 
 Post subject: Re: 3DSimED 3.1j
PostPosted: Sun Aug 13, 2017 7:09 am 
Offline
US Pits Crew
US Pits Crew

Joined: Thu Sep 01, 2005 9:58 am
Posts: 1299
Location: Barnet, London
Many thanks for that code, it looks like it should work but I was trying to find the data in the tire models that I am sure the game must use because these calculations take time and I find it hard to believe this process has not been optimized.

The tire selection is in some ways more important because just using the same tire model for every car is obviously wrong and we have other information I cannot find such as the control arm positions.

Anyway a big thanks for the code it may be the best way to go.

Cheers!

Dave N.

br555 wrote:
I can't help with the automatic tire model selection - maybe by year? I can help with re-scaling tire model vertices...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group