Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lightmap problem
#1
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.
UnityEditor.DockArea:OnGUI()

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

Is there anything I can do here?

cheers

Nalin
 
Reply
#2
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?
Reply
#3
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.

cheers

Nalin


Attached Files Image(s)
       
Reply
#4
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).
Reply
#5
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

N
Reply
#6
Did you have detached the Mesh and then set it to Static?
Reply
#7
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?

br

Nalin
Reply
#8
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"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Lightmap/Shadow issue TurboHans 4 58 11-24-2020, 08:33 AM
Last Post: TurboHans
  How do join 3 splines && Orientation problem athos_k 3 698 07-09-2020, 10:41 AM
Last Post: _Aka_
  Add Template problem in the Generator with Input Spline Shape prefab ATHellboy 1 840 03-13-2020, 11:27 PM
Last Post: _Aka_
  Mesh problem in generator after rotating control points ATHellboy 1 888 02-10-2020, 11:24 AM
Last Post: _Aka_

Forum Jump: