Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lightmap problem
Hi Jake

I am seeing this error when I create a meshbuilder and also when I save the curve as a game object

Primary UV set on CurvyMesh is incorrect and the secondary UV set is missing. Lightmapper needs UVs inside the [0,1]x[0,1] range. Skipping this mesh...
Choose the 'Generate Lightmap UVs' option in the Mesh Import Settings or provide proper UVs for lightmapping from your 3D modelling app.

As a result I cannot get the curv object to receive any shadows when lightmapping.

Is there anything I can do here?


To add the UV2, please edit SplinePathMeshBuilder.cs, in Refresh() add a line "mMesh.uv2 = new Vector2[mVerts.Length];" right after "mMesh.uv=mUV;" - that should do the trick.

If the UV's are beyond 0:1 you've scaled the material, right?
Thanks Jake,

Unfortunately it did not seem to work, as it led to darker outputs on the Curvy Meshes and still no shadows unfortunately.

If the UV's are beyond 0:1 you've scaled the material, right?
Well, all I did was set the UVMode to Absolute so I could get some blue stripes on the road, 

To illustrate the problem, I have attached two screenshots (real-time and lightmapped), and on each I have two sets of roads/paths - on the left is with the additional line of code and on the right is without it.  I have also put in a Unity cube across the scene to make sure it can capture the shadows which is does manage to do.

Any thoughts or ideas would be much appreciated.



Attached Files Thumbnail(s)
Tried this and I had to set UV mode to "Stretch V" (as well as the mesh to static), then it got lightmapped (even without the UV2 code).
Thanks Jake,

Unfortunately I tried this approach and still no lightmap shadows Sad

So for me Stretch V and with or without the UV code I had no luck Sad

Did you have detached the Mesh and then set it to Static?
Yeah tried that, but it did not work for me.

Maybe I am missing something else?

Do you have a test project at all that you can upload and I can examine?


I did the following:
  • Choose the Basic/MeshBuilder2 example scene
  • Enable shadows for the Directional light
  • Disable the animation for CurvySpline.CP001
  • Select the CurvyMeshPath
  • Make it static
  • Set UV mode to "Stretch V" and Tiling to "1" (you'll need to do the tiling in the material then)
  • Open Lightmapper and click on "Bake Selected"

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connections Problem Juton 3 16 03-06-2024, 10:41 AM
Last Post: _Aka_
  Switch Spline Problem erenjeagerot 4 11 05-30-2023, 10:49 AM
Last Post: _Aka_
  Problem with combining shape extrusion and DistanceToTF kazlik 3 4 01-08-2022, 11:53 AM
Last Post: _Aka_
Question Problem with working with multiple scenes KasimirBlust 5 122 12-08-2021, 10:07 PM
Last Post: _Aka_

Forum Jump: