|
|
Masking out fluids |
Posted by: billmccrary - 04-10-2019, 08:35 PM - Forum: Obi Fluid
- Replies (2)
|
|
Maybe an odd question / request - we have some fluid clipping through some geometry due to a large-ish render scale (5), and we'd like to be able to put some 'masking' geometry over the top of it that will allow the camera to see everything BUT the fluid. We don't have any shader specialists so wondering if that is something possible to do with obi fluids today or if that would be something someone knew how to do? I have simple sandbox examples of basic geometry working by reusing someone's stencil buffer shaders, but I don't know how to implement that against the fluids. Attached images of that simple sandbox stuff if it helps explain what I'm asking. Thanks!
|
|
|
[Obi Rope] Assign solver at runtime. |
Posted by: TimLewis - 04-10-2019, 02:40 PM - Forum: Obi Rope
- No Replies
|
|
Hi guys,
We're having an issue getting Obi rope to work correctly when the Solver is assigned at runtime, is there a way to force re-initialisation when we attached the solver?
We already use a Solver for fluid in another scene, and when we come into the scene with the ropes we wanted to use the same solver (as I assume having 2 solvers is more expensive than 1?)
so my questions:
1) Is there a way to re-init?
2) Is having 2 solvers much more expensive than 1?
3) Which behaviours are needed for rope solver (volume, shape matching etc) for the most lightweight solver, is there a scene with an example?
Thanks very much for your help guys.
Tim
In an addition to this, after hitting initialise on the rope prefab, we can no longer add pin constraints, is this something you're aware of?
|
|
|
"Heavier" Cloth |
Posted by: Elliot - 04-10-2019, 01:00 AM - Forum: Obi Cloth
- Replies (1)
|
|
Hey all,
Just started using Obi Cloth, and I'm loving it - it's working wonders. That said, I'm having trouble simulating what I would describe as a thicker/heavier cloth. Basically, even my big thick coats float around like tissues. Is there a way to make them feel like they have more weight and are thicker? I've tried:
- Playing with the weights of the points
- Playing with Aerodynamic Constraints (these have gotten me the closest so far, but everything still crumples to easily, and also if the settings are too high there's an increased likelyhood that the cloth just kind of goes nuts and explodes about).
- Playing with Bending Constraints (these don't seem to do anything at all).
Thanks!
|
|
|
LWRP issues |
Posted by: MasterGeneralB - 03-10-2019, 09:24 PM - Forum: Obi Fluid
- Replies (1)
|
|
So I'm trying to use a simple 2d fluid with the LW rendering pipeline and nothing I try is working...
I'm trying to get the basic obi particle renderer to work and show the fluid particles so I can at least see what I am doing. I found a previous thread about changing the tags in the shader.. but that didn't seem to do the trick.
The simpleparticleshader.shader file looks something like this at the moment:
Code: Shader "Obi/Simple Particles" {
Properties {
_Color ("Particle color", Color) = (1,1,1,1)
}
SubShader {
Pass {
Name "ParticleFwdBase"
Tags {"LightMode" = "LightweightForward" "RenderType" = "Opaque" "RenderPipeline" = "LightweightPipeline" "IgnoreProjector" = "True"}
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_fwdbase nolightmap
#include "ObiParticles.cginc"
fixed4 _Color;
fixed4 _LightColor0;
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
fixed4 color : COLOR;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
};
struct v2f
{
float4 pos : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
float3 lightDir : TEXCOORD1;
LIGHTING_COORDS(3,4)
};
v2f vert(vin v)
{
v2f o;
// particle positions are passed in world space, no need to use modelview matrix, just view.
float radius = v.t0.w * _RadiusScale;
float4 viewpos = mul(UNITY_MATRIX_V, v.vertex) + float4(v.corner.x, v.corner.y, 0, 0) * radius; // multiply by size.
o.pos = mul(UNITY_MATRIX_P, viewpos);
o.texcoord = float3(v.corner.x*0.5+0.5, v.corner.y*0.5+0.5, radius);
o.color = v.color * _Color;
o.lightDir = UnityObjectToViewPos(ObjSpaceLightDir(v.vertex));
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
// generate sphere normals:
float3 n = BillboardSphereNormals(i.texcoord);
// simple lighting: diffuse
float ndotl = saturate( dot( n, normalize(i.lightDir) ) );
// final lit color:
return fixed4(i.color.rgb * (_LightColor0 * ndotl + UNITY_LIGHTMODEL_AMBIENT),i.color.a);
}
ENDCG
}
Pass {
Name "ShadowCaster"
Tags { "LightMode" = "LightweightForward" }
Offset 1, 1
Fog {Mode Off}
ZWrite On ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster nolightmap
#include "ObiParticles.cginc"
struct vin{
float4 vertex : POSITION;
float3 corner : NORMAL;
float4 t0 : TEXCOORD0; // ellipsoid t1 vector
};
struct v2f {
float4 pos : POSITION;
float3 texcoord : TEXCOORD0;
};
v2f vert( vin v )
{
v2f o;
float radius = v.t0.w * _RadiusScale;
float4 viewpos = mul(UNITY_MATRIX_V, v.vertex) + float4(v.corner.x, v.corner.y, 0, 0) * radius;
o.pos = mul(UNITY_MATRIX_P, viewpos);
o.texcoord = float3(v.corner.x*0.5+0.5, v.corner.y*0.5+0.5, radius);
return o;
}
fixed4 frag( v2f i ) : SV_Target
{
float3 n = BillboardSphereNormals(i.texcoord);
return fixed4(0,0,0,0);
}
ENDCG
}
}
FallBack "Diffuse"
}
I believe I added the right tags to both passes.. and changed the line
Code: o.lightDir = UnityObjectToViewPos(ObjSpaceLightDir(v.vertex));
as Unity was screaming a warning log at me about using Matrix_MV. I'm not entirely sure if that's how it should look as I am a newb with shaders... But I can definitely tell you that it still does not work. I don't see anything on my camera screen. That said, the simulation DOES work, but for me to see the particles (and only with the editor camera during playmode) I need to press the edit particles button on the obi emitter component.
Also, I am getting a log "Material Property is found in another cbuffer than 'UnityPerMaterial' (_Color)". Googling about, I found that to get it working with the SRP Batcher it needs to be in a CBUFFER_START(UnityPerMaterial) CBUFFER_END block... but I don't know how to implement that either... if anyone knows how, that would be great.
|
|
|
Obi Fluid Collision Callback never ending |
Posted by: RjcArci - 29-09-2019, 11:40 PM - Forum: Obi Fluid
- Replies (1)
|
|
Im new to Obi and i have a problem with the collisions.
I have a flask which is generating a liquid(Obi Emiiter) and a floor (Obi Collider) that interacts with that liquid.
I made different floors each one with the PhLandController script that i only want to call when the liquid collides with the floor
I also have an (Obi Solver) which have the following script.
Code: using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Obi;
[RequireComponent(typeof(ObiSolver))]
public class FluidPhCollisionHandler : MonoBehaviour {
ObiSolver solver;
PhLandController phController;
void Awake(){
solver = GetComponent<Obi.ObiSolver>();
}
void OnEnable () {
solver.OnCollision += Solver_OnCollision;
}
void OnDisable(){
solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision (object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
Oni.Contact contact = e.contacts[0];
Component collider;
if (ObiCollider.idToCollider.TryGetValue(contact.other,out collider)){
phController = collider.GetComponent<PhLandController>();
phController.increasePHLevel();
}
}
}
The problems is that after i remove the liquid from colliding to the floor the method increasePHLevel() is call infinitly.
The only way to stop it is that the liquid begins a new collision with a different floor but the problem is now pass to the new floor method is call infinitly.
Any suggestion how i could fix this ?
Thanks
|
|
|
Is this asset viable for this? |
Posted by: wojwen - 28-09-2019, 05:49 PM - Forum: Obi Softbody
- Replies (1)
|
|
I'm thinking about using this asset for my next project, a blacksmith game. Would this asset be viable for simulating a pliable metal? What I mean precisely is whether the deformations this asset provides are physically correct (enough) to allow for predictable manipulation (for example a metal rod that could be flattened and its volume wouldn't change in the process). The other aspect is changing the properties of the softbody in runtime to make it more/less pliable. The last thing is the max "resolution" of the softbody. Could I make it very precise and realistic or are there limits when it comes to changing the particle size?
|
|
|
Mobile Suggestions + Help |
Posted by: neecko - 26-09-2019, 10:17 PM - Forum: Obi Fluid
- Replies (4)
|
|
I've read all over your forums and website that the regular Obi Fluid Rendered is too much for mobile devices.
Seems like 3d would really useful for mobile devices, but I can make 2d work for what I need if I can address these issues.
I don't know shaders that well at all, but if I use the simple renderer I need to add depth or the particles will get drawn over objects. I haven't the faintest idea on how to do this. Any help?
-
The Raclette demo is perfect for what I'm going for, but that doesn't seem to work in 2D. Basically I have lava that "cools" and turns black as it stops moving. What would be my best option to do that? Any way I can detect this is happening so I can spawn smoke from these areas?
Thanks for your help.
|
|
|
|