A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by jbooth, Aug 9, 2017.
Gotcha... ok thanks so much for the quick replies! Great info.
Hello there, I dont have really much Experience in Unity and choosed the Asset Microsplat to learn about Terrains.
I created a Project to learn with Microsplat and everything went fine.
Now, i created a new Project and i dont know what i missed, because something went wrong:
The textures are shiny and looking wet. I copied the Microsplat settings from my old Project but its still shiny.
Heres a Picture:
Whats wrong here ? With exact the same settings from the old Project shouldnt it be the same?
Hope someone here can help me.
hard to say from the shot but likely you missed something when copying the data. Also, if you are copying within a project there are a number of references that need to be changed to the duplicate files.
Hm, i guess it has something to do with the normal maps because if i turn off normal maps in microsplat settings the shinyness disappear. Still searching a solution maybe i should just continue use my old project but thx for the help.
Hey Jason, so I did a bit more digging and I am not exactly sure how to get the MicroSplat alphamaps.
My prior alpha values were based on a Terrain that was created with normal texturing and then "converted" to a MicroSplat array. Apparently, I was having issues because the GetAlphamaps() code was returning the original terrain texture data prior to me enabling MicroSplat.
I have since deleted that Terrain and have started from scratch but this time working with MicroSplat before I put any textures on the terrain.
Using a Texture Array of 9 different textures, when I actually use the following code to retrieve the alphamaps at any given point
float[,,] aMap = terrain.terrainData.GetAlphamaps((int)terrainPositionXZ.x, (int)terrainPositionXZ.y, 1, 1);
I do get the 9 Textures from the array but every single point in the terrain I only get a texture value for the first Texture (as seen in the following image):
There is no doubt that the MicroSplat Low Poly is in effect and I am absolutely loving it. I just can't seem to get any correct information about the texture data at runtime.
MicroSplat doesn't affect the alpha maps on the terrain at all- it just reads that data and renders it. MicroSplat on or off, you will get the same data from terrainData.GetAlphaMaps..
You might check your textures to make sure you are setting up the smoothness values correctly for them (in the Texture Array Config), when you turn off normal mapping, you also turn off smoothness and AO values, since they are (by default anyway) packed in with the normal data..
as always, thanks for the great work.
I've started using Trax as part of a project, currently I'm having some performance problems with it (I think).
As you can see in the image below, when profiling the player, the hierarchy view in the profiler is quoting TraxManager.LateUpdate as regularly using 9+ms.
This seems high, I have a single trax manager in scene and 8 objects with simple 'sphere shaped' proxies, only 1 texture has a trax opacity > 0. I'm using a single texture and snow is turned off.
My settings for it are reasonably limited: 1024 Buffer Size, 300 world size - running on a GTX 1070 and an i7-8750
Thanks for your time and the product.
yeah, that not actually trax; you’ll notice the wait for target FPS in there? That’s it either waiting for VSync or waiting until the GPU catches up to add the new rendering commands.
I'm currently trying to setup terrains and assign custom splat maps programmatically - doing it by hand for 344x16 maps seems a bit cumbersome
The problem is that after doing so, the terrains don't look right until I select them in the editor:
In essence the code looks similar to this:
var microSplat = terrain.gameObject.AddComponent<MicroSplatTerrain>();
microSplat.templateMaterial = templateMaterial;
microSplat.customControl0 = splatMap;
I tried numerous ways to set things dirty, select terrains in a loop, even too recompile the shader via the MicroSplatCompiler, but so far no luck. Any idea how to get around this issue?
So you have to hook up the rest of the objects to the MicroSplatTerrain component- mainly the PropData, which holds per-texture properties and such, but others like the keyword object may be required (depending on features). Further, SetDirty only matters to mark the object dirty so the editor will save it, and Sync should only need to be called at the end.
Whooohoo, now it works perfectly Thanks Jason
hi, in regards to the streams and puddle module, is there a cheap way of sampling if there are streams or puddles in the current player position? I need that to play effects when player walks on water etc.
Thanks for your time
Yeah, there's no API for it, but you can sample the stream texture's pixels, it's a weight map with wetness/puddles/streams/lava in RGBA respectively.
Thanks, I will look into it. Just so I know, will it be very expensive to play every frame or so you think? I can always create a collision trigger in the areas I have puddles etc, which should be straight forward to do, but ideally sampling the map directly will be much better if its not going to affect fps.
No, it shouldn't be that expensive unless you have hundreds of objects doing it.
Hey, just downloaded microsplat and bought the anti-tiling and advanced details module.
This is a great product, however I am running into "basic" issues. I am using Unity 2019.4.2f1.
Issue1: Trying to generate lightmap for the terrain, but can not make it work (built in render pipeline, forward rendering) the lightmap generates but does not effect the terrain.
solved, juse needed to adjust the light intensity settings..
Issue2: Trying to use post processing effects, mainly works, but can not get the ambient occlusion to work properly, the entire terrain becomes dark when adding intesity to the ambient occlusion.(latest post processing package)
(not really an issue)Issue3: any additional package to add color variation to texture not only normal noise and not geo? (for example green grass and I'd like to add yellow patches)
Looking forward for some help! THX!
Advanced Details Module is not written by me, and the author has not replied to anyone in over a year- I would put in for a refund with Unity, as that module is not compatible with MicroSplat any longer. I've been trying to get it removed from the store so this doesn't happen to people. There is a Scatter module now, which fills much of the same role, and is supported.
Issue1: MicroSplat is a surface shader in the standard pipeline- so it doesn't actually contain the light mapping code, and gets injected in by Unity. Most likely there is some configuration issue you have to figure out which doesn't have anything to do with the shader (In SRPs this is different, and it could be a shader issue).
Issue2: The terrain has already been rendered into the buffer by the time post processing happens, so not a MicroSplat issue. However, most post processing AO systems require a normal map to work with, and if your in forward rendering you're not rendering a GBuffer, and the only normal which would be available would be the mesh normals, if you turn on the camera's rendering of a normal buffer. So likely what is happening is it's just darkening because it has no data to actually work with, but you'll have to look in the post processing system docs to figure that out.
i want to use the Global Texturing and want to achieve the desert-look like in your sample scene.
i got the terrain converted to microSplat per Core doc.
however, it seems like the microSplat GUI is not the same as the Core doc after the conversion.
so, not sure where to proceed to use the Global Texturing.
i tried to click on the SYNC button, nothing changed.
tried SYNC ALL, nothing changed.... oh, would be nice to add "tooltips" to those buttons of what those buttons do.
also, i checked out the Global Texturing doc but it doesn't explain how to use it... it explains "what it is" but doesn't explain how to use it.
i'm using Unity 2019.4.9f1 and microSplat Terrain Collection 3.4801
attached image is microSplat GUI after i clicked on the "CONVERT TO MICROSPLAT"
That’s not the MicroSlat GUI- that’s Unity’s terrain UI- you need to select the material (either by double clicking on it in the MicroSplatTerrain component or selecting it in the MicroSplatData directory).
I'm using MicroSplat (3.5) on a PS4 VR game and it's not working in VR mode. One eye (believe it's the left) renders mostly correct but the right eye doesn't render at all. The following errors are reported when making the build. I'm using 2019.4.8f1 with the new XR plugin architecture (3.2.15) which I believe is using single pass instanced. There's no longer an option use multi pass or singe pass and I suspect it may be related to SPI.
Any thoughts on what might be going on?
Shader error in 'MicroSplat/Terrain_0_0_5b429a5e-404d-4478-ab5a-777e9121ad9c': Program 'vert_surf', 'S_RENDER_TARGET_INDEX' is not a valid semantic for attribute 'v.stereoTargetEyeIndex'
Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL LIGHTMAP_ON DIRLIGHTMAP_COMBINED LIGHTMAP_SHADOW_MIXING SHADOWS_SHADOWMASK LIGHTPROBE_SH STEREO_INSTANCING_ON
Shader error in 'Hidden/MicroSplat/Terrain_0_0_5b429a5e-404d-4478-ab5a-777e9121ad9c_Base-1715511970': Program 'vert_surf', 'S_RENDER_TARGET_INDEX' is not a valid semantic for attribute 'v.stereoTargetEyeIndex'
Compiling Vertex program with UNITY_PASS_FORWARDBASE DIRECTIONAL STEREO_INSTANCING_ON
If your in the standard pipeline, then it sounds like a bug in Unity’s surface shader system. In Standard pipeline I use a surface shader, which automatically handles things like VR and lighting, so there’s no VR specific code in the shader. Your best bet it to file a bug with them on it.
Ok, I'll pass this off to the Unity support to look at. Is there any additional info or instructions I should give them other than what you mentioned above?
I forgot to ask but what about those build errors? I don't think those would be related to a Unity bug and look like shader incompatibilities with the PS4.
No, they are exactly what would be a unity bug. A surface shader does not contain this code- it gets generated automatically by Unity, so if something is wrong with the generation, you get a compile error like this. You'll notice the shader itself doesn't have any mention of stereoTargetEyeIndex and such if you search through it.
Hello @jbooth, thanks for your amazing software.
I am creating a quality settings menu for our game and our artist has told me the Tesselation value of the terrain is the main factor, so I have two questions:
1) On what script is this Tesselation defined, is it a shader parameter? Is there a static way to access it, or I need to manually link some material?
2) Are there other settings that could be potentially performance-intensive?
Of course I need values that can be switched at runtime and in build. My apologies for being quite ignorant on microsplat and graphics...
If you want to control the tessellation factor that can be accessed via the standard material.SetFloat calls. Usually what you want to do is do this on the template material and then call MicroSplatTerrain.SyncAll() to propagate the change across all terrains, but if your calling it every frame you might want to be more granular than that.
If you need to turn features on/off, then you would need to pre-compile multiple shader variants and swap them at runtime. Feature cost is a complex topic, but under the Debug section of the material you can see how many potential texture fetches MicroSplat might do per pixel, though that can be reduced heavily by branch sampling in some cases. Anyway, there's an optimization guide in the core/documents folder.
Thanks! I will only call that SyncAll when graphics settings are changed.
What is the name of the Float parameter? sorry for my lack of familiarity with graphics.
There's a _TessData1 and _TessData2 float4 that I think has all the tessellation parameters in it- you'll have to look in the fragment file and see which channel it's packed into, most likely _TessData1.x or something..
thanks, I got it. In case anyone else wants it:
SetVector ("_TessData1",new Vector4(tesselation,displacement,upbias,0))
hey @jbooth -
I've just installed scatter and updated all my modules to v3.5
As soon as I updated them all I started getting the following Error everytime I recompile the shader
Shader error in 'MicroSplat/Terrain': undeclared identifier 'config' at line 3121 (on d3d11)
This only occurs with Tesellation turned on and per texture mip map bias. With per texture mip map bias turned off it's fine.
My terrain now appears to be broken, any ideas? I'm on Unity 2019.3.13f1
Can you show me the code around that line number? Line numbers change based on features, so they don't do any good unless I can see what code the issue is in.
the line number in question in this snippet is 31, same error. I can send more if needed
float3 OffsetVertex(inout float4 vertex, float3 normal, inout float4 tangent, float2 texcoord)
#if !_MICROMESH && !_MICRODIGGERMESH && !_MICROVERTEXMESH
tangent.xyz = cross(normal, float3(0,0,1));
tangent.w = -1;
tangent = tangent;
float2 controlUV = texcoord;
controlUV = InverseLerp(_UVMeshRange.xy, _UVMeshRange.zw, controlUV);
float3 worldPos = mul(unity_ObjectToWorld, vertex).xyz;
worldPos = vertex;
float3 worldNormal = float3(0,0,1);
#if _SNOW || _TRIPLANAR
worldNormal = UnityObjectToWorldNormal(normal);
half4 mipLevel = _TessData1.z;
#if _PERTEXTESSMIPLEVEL && !_DISABLESPLATMAPS
SAMPLE_PER_TEX(perTexMipLevel, 4.5, config, half4(1.0, 0.0, 0, 0.0));
mipLevel.x = perTexMipLevel0.a;
mipLevel.y = perTexMipLevel1.a;
mipLevel.z = perTexMipLevel2.a;
mipLevel.w = perTexMipLevel3.a;
Config config = (Config)0;
fixed4 w0 = fixed4(1,0,0,0);
fixed4 w1 = 0; fixed4 w2 = 0; fixed4 w3 = 0; fixed4 w4 = 0; fixed4 w5 = 0; fixed4 w6 = 0; fixed4 w7 = 0;
Fixed, patch should be out tomorrow-ish..
Thanks very much, always super helpful!
I do have 1 other problem since yesterday's update, some of my terrain textures are not affected by ambient light at all, they are 100% black when in shadow. I have swapped the textures in the config to match that of another texture which is affected by ambient light.
Even after playing with all the per texture properties, some of the texture stay stubbornly unaffected by the ambient.
Ever see this occur?
I am using Microsplat and Microsplat URP support but can't add a material to a terrain in Unity without having it shown in pink! I have found this line in the doc: "Note that your shader will appear pink if it is compiled for a
render loop which is not active in your project." but have no idea where to look into it and change things to make it work. Didn't find anything useful.
Any help welcome making Microsplat work with URP. I am using the latest Untiy version 2020.1.6f1
This seems like the same problem I have and it still is unanswered. Can you please help with fixing this?
No, and in a surface shader I don't even write lighting code. Sounds like something with the lighting setup or you ability to see ambient on those textures- as ambient lighting doesn't know about what textures it's on, really.
Read the Unity docs on how to convert or start a project in URP, then read the included docs for MicroSplat's URP module which show you how to change the render loop on the material to URP. Also read the asset description which clearly states which versions of the URP are supported, as you are running an unsupported tech release instead of an LTE release.
I really like your new Decal addition. It’s working nicely on my terrain but I gave it a try on on MicroSplat Mesh and I’m having what seems to be some transparency issue. I’m not sure if it’s compatible yet with your Mesh module or it’s just me who did something wrong ?
It should work on meshes, but only dynamic decals are supported. Can you post a screenshot of the issue?
here's what I got. Took a copy of your decals.
My floor here is a mesh ( it's all working fine on terrains). I tried both Dynamic & Static with same result.
Thanks for your help
EDIT: I just tried with your rocks decal and it works because there's an alpha map for it. And even Static seems to be working fine on a mesh ;-)
EDIT2: it seems the alpha map is required. I probably misread that step by with an alpha it's all good.
Hi there. I just started using Microsplat recently and was trying to get terrain blending to work on some rocks that are supposed to be cropping out of the terrain. I'm seeing a couple of things that I don't really know how to debug/diagnose/resolve.
1) I am seeing some hard seams from the terrain textures on my rocks, could this be related to my splatmap resolution?
2) I am seeing blending on the bottoms and sides of objects that I believe should be excluded per the curve/slope and contrast settings I'm using. Is this a problem with my UVs?
Any help, tips, etc, appreciated. Thanks!
Your UVs don't come into play with terrain blending- the shader projects the UVs from the terrain (UV, WorldSpace, or Triplanar) onto the object, so the actual UVs on the model are not used. Note that the filtering you're expecting based on curve/slope is based on the vertex normal, which is interpolated across the face; not the face normal. The hard seems I'm not exactly sure about- it could be from the angle filter (or if you have a seem in the original texturing).
Microsplat continues to be wonderful, but I need a little help.
I had my terrain textures setup so that they completely covered the texture below them. After I rebuilt the config file now the textures are all spotted, like they cover each other with little dots instead of slid. Im attaching an image of what I mean. Im using it in Mapmagic is that's important.
I can't figure out what I did before to make the coverage solid and I am trying all kinds of configs like the interpolation contrast (which tightens the transition but the main texture does not go solid) and disabling normal Maps (I don't add normal maps in the config though) and I remember the first time I achieved the solid look it was just an accident so I don't remember what I did. Id love to get it back because it blends well with the grass when I add it.
Do you have any ideas? Thank you.
It could be the Texture Blend Mode, try changing it to one of the other settings.
Either your height maps are different, or your splat maps (generated by MM2) are different.
I see, this is helpful to go on. It seems like the blending issues (sides and bottoms) I am seeing are possibly due to low polygon counts along the sides then resulting in the interpolation coming to the wrong conclusion about the slope. I'm going to try and raise the poly count a bit and see if that helps with that.
For the seams, I think I will try and blend a bunch of different objects around the terrain and see if I notice any patterns that may be related to the way the terrain is currently textured. I'll also try putting the objects in my actual scene instead of just this dev scene with a junk terrain.
These are the settings for the micros plat config file and the material it generates.
Is the texture blend mode you're talking about one of these?
Thank you Im using MM1 and its the same project, so I know its possible to get the original result, im just not sure what I changed. I remember back when that it suddenly became solid after a lot of testing, but I never figured out why and I just didn't change the MS config file for severe months until now.
What do you mean my height maps are different? Mapmagic generates the height maps in realtime, do you think like there is some kind of mapmagic height map setting that I can change? Because I don't know really where my height maps are since they are generated.
On the generated terrain there is this microsplat component that has splatmaps in them. Maybe its something here?
Im grasping at straws but will try anything
I was referring to the Texture Blend Mode setting here (different version?), I think the equivalent setting you listed is Disable Height Blending.