Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BuildVolumeMesh issue
#32
(11-16-2022, 07:00 PM)tairoark Wrote:
(11-16-2022, 10:35 AM)_Aka_ Wrote: I think you can solve it doing the following:
listening on the OnRefresh event, in it update the UV offset then call yourGenerator.Refresh(). That way the UVs are updated before the next frame rendering

That is what I'm doing:

Code:
var bvm = gen.GetModule<BuildVolumeMesh>( "Track Vol Mesh", true );
bvm.SetMaterial( 0, material );
bvm.MaterialSetttings[ 0 ].KeepAspect = CGKeepAspectMode.ScaleV;
var cm = gen.GetModule<CreateMesh>( "Track Create Mesh", true );
cm.OnRefresh.AddListenerOnce( _ => {
    var prevSeg = seg.Spline.GetPreviousControlPoint( seg );
    float savedForNextSegUVOffsetY;
    if (prevSeg == null) { 
        savedForNextSegUVOffsetY = bvm.MaterialSetttings[ 0 ].UVOffset.y + bvm.groupsByMatID[ 0 ].AspectCorrectionV;
    }
    else {
        savedForNextSegUVOffsetY = prevSeg.EndBias + bvm.groupsByMatID[ 0 ].AspectCorrectionV; // EndBias will hold the accumulated Offset to the end of it's segment
        if (prevSeg.GetMetadata<TrackMetadata>().Geo.materialName == geo.materialName
         && Math.Abs( bvm.MaterialSetttings[ 0 ].UVOffset.y - prevSeg.EndBias ) > 0.001f) {
            bvm.MaterialSetttings[ 0 ].UVOffset.y = prevSeg.EndBias;
        }
    }
    if (Math.Abs( savedForNextSegUVOffsetY - seg.EndBias ) > 0.001f) {
        seg.EndBias = savedForNextSegUVOffsetY;
    }
    gen.AutoRefresh = true;
} );
gen.Refresh( true );
 
Where does this code belong?
Have you tried calling gen.Refresh inside the event listener, in place of gen.AutoRefresh = true? I advise to listen on the OnRefresh event of the generator and not the module, so that you don't trigger a Refresh operation in the middle of the execution of a previous Refresh. When the generator's OnRefresh is called, you know that the refreshing is over.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Messages In This Thread
BuildVolumeMesh issue - by tairoark - 10-30-2022, 03:20 AM
RE: BuildVolumeMesh issue - by _Aka_ - 10-30-2022, 12:12 PM
RE: BuildVolumeMesh issue - by tairoark - 10-30-2022, 05:40 PM
RE: BuildVolumeMesh issue - by tairoark - 10-30-2022, 11:15 PM
RE: BuildVolumeMesh issue - by _Aka_ - 10-31-2022, 10:18 PM
RE: BuildVolumeMesh issue - by tairoark - 10-31-2022, 11:08 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-01-2022, 03:50 PM
RE: BuildVolumeMesh issue - by tairoark - 11-03-2022, 02:59 AM
RE: BuildVolumeMesh issue - by _Aka_ - 11-03-2022, 09:39 AM
RE: BuildVolumeMesh issue - by tairoark - 11-03-2022, 12:49 PM
RE: BuildVolumeMesh issue - by _Aka_ - 10-31-2022, 10:35 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-01-2022, 09:41 AM
RE: BuildVolumeMesh issue - by tairoark - 11-01-2022, 03:48 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-01-2022, 03:51 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-01-2022, 10:38 AM
RE: BuildVolumeMesh issue - by tairoark - 11-11-2022, 09:08 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-14-2022, 10:06 AM
RE: BuildVolumeMesh issue - by tairoark - 11-15-2022, 04:56 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-01-2022, 03:39 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-01-2022, 03:53 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-03-2022, 04:27 PM
RE: BuildVolumeMesh issue - by tairoark - 11-11-2022, 05:27 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-14-2022, 10:01 AM
RE: BuildVolumeMesh issue - by tairoark - 11-14-2022, 08:25 PM
RE: BuildVolumeMesh issue - by tairoark - 11-11-2022, 10:00 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-14-2022, 10:15 AM
RE: BuildVolumeMesh issue - by tairoark - 11-15-2022, 12:21 PM
RE: BuildVolumeMesh issue - by tairoark - 11-16-2022, 03:39 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-17-2022, 11:16 AM
RE: BuildVolumeMesh issue - by tairoark - 11-17-2022, 01:56 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-18-2022, 08:15 AM
RE: BuildVolumeMesh issue - by tairoark - 11-18-2022, 06:16 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-21-2022, 03:21 PM
RE: BuildVolumeMesh issue - by tairoark - 11-24-2022, 07:25 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-15-2022, 08:44 AM
RE: BuildVolumeMesh issue - by _Aka_ - 11-16-2022, 10:35 AM
RE: BuildVolumeMesh issue - by tairoark - 11-16-2022, 07:00 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-17-2022, 10:11 AM
RE: BuildVolumeMesh issue - by tairoark - 11-17-2022, 01:22 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-21-2022, 03:19 PM
RE: BuildVolumeMesh issue - by _Aka_ - 11-25-2022, 07:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Rasterized Path Range issue proton 3 15 Yesterday, 09:26 AM
Last Post: proton
  Rotation issue with generator nicolaj.h.andersen@gmail.com 1 15 04-14-2023, 11:58 AM
Last Post: _Aka_
Exclamation DuplicateEditorMesh performance issue Guillaume 5 12 01-18-2022, 01:44 PM
Last Post: _Aka_
  Lightmap/Shadow issue Sacryn 4 1,524 11-24-2020, 08:33 AM
Last Post: Sacryn

Forum Jump: