xraxra / imp Goto Github PK
View Code? Open in Web Editor NEWbillboard imposter baking for Unity
billboard imposter baking for Unity
Would be good to have proper shadows from imposters, currently you can see that the imposter is attempting to cast & receive shadows when shadows enabled (renders unmodified flat quad)
I'm assuming it is Compute Shader related, it might not be dividing up the thread groups in a good way at certain resolutions.
Would like to revisit the bake code and better present the baking progress while waiting, since currently there is no indication of progress. This could also help track down what is causing the freeze that was reported.
Great assets. Trying it out in my project and seems to work great when switching to my long distance camera.
Is there a way to have them cast shadows?
Regards
I'm trying to understand FrameTransform() in ImpostorCommon.cginc, if I understand correctly it's used to find the vertex projected into the neighbor frames?
half3 ITBasis( half3 vec, half3 basedX, half3 basedY, half3 basedZ )
{
return half3( dot(basedX,vec), dot(basedY,vec), dot(basedZ,vec) );
}
half3 FrameTransform( half3 projRay, half3 frameRay, out half3 worldX, out half3 worldZ )
{
//TODO something might be wrong here
worldX = normalize( half3(-frameRay.z, 0, frameRay.x) );
worldZ = normalize( cross(worldX, frameRay ) );
projRay *= -1.0;
half3 local = normalize( ITBasis( projRay, worldX, frameRay, worldZ ) );
return local;
}
worldX
and worldZ
should be the neighbor quad basis, but I have no idea what ITBasis()
does here, it just finds the length of the view ray projected to the neighbor quad basis vectors but I don't understand how it relates to the projected point in the neighbor quad.
Also the way it's used
FrameTransform( projInterpolated, frame0ray, plane0x, plane0z );
where
half3 frame0ray = FrameXYToRay(frame0, framesMinusOne.xx);
frame0Ray
here is the vector from octahedron center to the camera position where the frame was captured right?
Introduced in 2018.3.b5:
SkinnedMeshRenderer.forceMatrixRecalculationPerRender. This property should be set in cases where the user would like to manually render a skinned mesh multiple times within a single update, an example of this would be rendering out the results of an animation to a texture.
This would be an awesome feature -- especially if it included the ability to animate particles too.
I first noticed these being used in Super Mario Odyssey's "Cascade Kingdom", where there were clearly "Animated Imposters" for the very distant 3d background waterfall mountains surrounding the main scene. This would enable some interesting 2D-3D game element generation for distant things with limited rotations (when using, say, the half-sphere approach.)
This bug can't be clearly seen when you merge 3 nearest frames like what you're doing now at here:
half3 frame0ray = FrameXYToRay(frame0, framesMinusOne.xx); half3 frame1ray = FrameXYToRay(frame1, framesMinusOne.xx); half3 frame2ray = FrameXYToRay(frame2, framesMinusOne.xx);
Thus to clearly see it, I edited the code to make it render one frame only which is frame0
.
Now when I put the camera right below the Imposter object, the Imposter object disappear.
The bug happens in the function OctaSphereEnc() in file ImposterCommon.cginc.
I notice the bug happen when the value of vec equals (-1,-1,-1), thus I fix it by tweaking it to (0,-1,-1). Like the code beblow:
half3 OctaSphereEnc(half2 coord)
{
half3 vec = half3(coord.x, 1 - dot(1, abs(coord)), coord.y);
if (vec.y < 0)
{
if (vec.y == -1 && vec.z == -1 && vec.x == -1) //Fix the bug!!!
{
vec.x = 0;
vec.z = -1;
}
half2 flip = vec.xz >= 0 ? half2(1, 1) : half2(-1, -1);
vec.xz = (1 - abs(vec.zx)) * flip;
}
return vec;
}
But the fix isn't perfect the because the frame is still twisted a little.
The created imposter object can not be seen on iPhone X/Xs, but can be displayed normally on iPhone 6 and Unity player&editor.
2018.2.11
No matter what we do it comes out distorted with artifacts
Hello,
IMP can definitely help to greatly improve the performance of my game. But I found it always create black pictures of *baked_ImposterBase.png and *baked_ImposterPack.png.
I use IMP in Unity 2019.1.0f2 on macOS Mojave (Version 10.14.6). And what else can I do to help to investigate the issue?
Many thanks for your great tool!
The project could use a license to cover its use by others. Keijiro Takahashi is a good person to emulate here. His code is usually either MIT or CC0.
https://github.com/keijiro/Skinner/blob/master/LICENSE.md - MIT
https://github.com/keijiro/StableFluids - CC0
Hi,
I'm currently trying to implement this technique in my engine, and while trying to understand how it works, I've some trouble understanding this code:
//subtract from camera pos
vertexOffset = normalize(objectSpaceCameraPos-vertexOffset);
//then add the original projected world
vertexOffset += projected;
//remove position of vertex
vertexOffset -= vertex.xyz;
//add pivot
vertexOffset += imposterPivotOffset;
If I comment the previous lines and later in the file, replace:
imp.vertex.xyz += vertexOffset;
by
imp.vertex.xyz = vertexOffset;
It looks like it gives exactly the same result.
Am I missing something ?
needs investigation, known issue
I see that dilation is done to the atlas, but why? What's the use of it? I didn't find anything related to dilation usage in the papers.
Thanks for posting this project! Unfortunately, when I open in 2018.1, the impostor groups in the demo scene all contain Missing Prefabs. I'm guessing this is due to missing meta files?
https://assetstore.unity.com/packages/tools/utilities/easy-imposter-128286
Look at the screenshots. The Baking interface is identical.
Is this allowed?
Platform does not support compute shaders
UnityEngine.ComputeShader:Dispatch()
ImposterBakeWindow:CaptureViews(Transform, BillboardImposter, Snapshots[], Transform, Shader, Shader, ComputeShader) (at Assets/Plugins/IMP/Editor/ImposterBakeWindow.cs:636)
ImposterBakeWindow:Draw() (at Assets/Plugins/IMP/Editor/ImposterBakeWindow.cs:179)
ImposterBakeWindow:OnGUI() (at Assets/Plugins/IMP/Editor/ImposterBakeWindow.cs:81)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.