• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=Silentfood;40871219]So I jumped into perlin and made this voxel thing, few questions. How can I optimise this so I only render faces visible, because generating a 150x150 world of normal blocks makes me reach around 15 fps (which is expected).[/QUOTE] You'll want to generate your mesh by going through each block and checking which of the faces are touching an empty block. Add these faces to the mesh, leaving the others out. When you've done this, you're left with a mesh that contains only faces that can possibly be viewed, since they're the ones touching 'air'. [editline]2nd June 2013[/editline] This isn't the only optimisation you can do, but it's definitely one of the easiest.
[QUOTE=Chris220;40871261]You'll want to generate your mesh by going through each block and checking which of the faces are touching an empty block. Add these faces to the mesh, leaving the others out. When you've done this, you're left with a mesh that contains only faces that can possibly be viewed, since they're the ones touching 'air'. [editline]2nd June 2013[/editline] This isn't the only optimisation you can do, but it's definitely one of the easiest.[/QUOTE] The issue I come across with creating a mesh would be having it updated every time a block changes in the world, I may try something with creating planes in places where a block doesn't cover the side.
[QUOTE=Silentfood;40871219]So I jumped into perlin and made this voxel thing, few questions. How can I optimise this so I only render faces visible, because generating a 150x150 world of normal blocks makes me reach around 15 fps (which is expected). How can I make Mathf.PerlinNoise random on each run, it seems to use the same seed each time I run the scene. [img]http://i.imgur.com/9R1RZQL.png[/img][/QUOTE] The seed is whatever you feed into the x and y parameters of Mathf.PerlinNoise()
[QUOTE=Silentfood;40871374]The issue I come across with creating a mesh would be having it updated every time a block changes in the world, I may try something with creating planes in places where a block doesn't cover the side.[/QUOTE] If you use relatively small chunks it shouldn't be too much of a problem to just regenerate that chunk's mesh whenever a block inside it changes. It can be made faster through the use of octrees as well, I'm not sure on the specifics of that though since I've never done it myself.
[QUOTE=Silentfood;40871374]The issue I come across with creating a mesh would be having it updated every time a block changes in the world, I may try something with creating planes in places where a block doesn't cover the side.[/QUOTE] I once found this great article, might be useful for you. [url]http://www.blockstory.net/node/56[/url]
[QUOTE=Silentfood;40871219]So I jumped into perlin and made this voxel thing, few questions. How can I optimise this so I only render faces visible, because generating a 150x150 world of normal blocks makes me reach around 15 fps (which is expected). How can I make Mathf.PerlinNoise random on each run, it seems to use the same seed each time I run the scene. [img]http://i.imgur.com/9R1RZQL.png[/img][/QUOTE] just pass the system time as a seed :) different every second.
Thanks guys for the information, I'll look into splitting mesh into chunks.
Find the seam :v: [img]http://i.imgur.com/JW1zLvE.png[/img] 100% certified coherent [editline]2nd June 2013[/editline] Still don't know what I want to do with this project. :v: Just having fun generating terrain
[QUOTE=Asgard;40876870]Find the seam :v: [img]http://i.imgur.com/JW1zLvE.png[/img] 100% certified coherent [editline]2nd June 2013[/editline] Still don't know what I want to do with this project. :v: Just having fun generating terrain[/QUOTE] It would be cool if you turned it into a risk style board game
I'm probably going to create some kind of intermediate chunk that lerps between two amplitudes. The terrain isn't diverse enough at this point.
When the exams will end and (hopefully) I'll get a good laptop, I am definately going to study Unity. I've tried already on a shitty laptop, but it didn't went out well. I had some problems with both 3Ds Max and Unity. Can you recommend where should I study Unity? I've been using DigitalTutors before, but not sure if they can help me a lot in game development.
Haven't used it but [url]http://unitygems.com/[/url] seems very useful.
Has anyone ported over GWEN to Unity yet?
Make games, not code. If the script works well and does what you want then go for it.
Any recommended free assets from the asset store? [editline]edit[/editline] Does anyone have any experience with this: [URL]https://www.assetstore.unity3d.com/#/content/3779[/URL]
[QUOTE=Pelf;40886172]Any recommended free assets from the asset store? [editline]edit[/editline] Does anyone have any experience with this: [URL]https://www.assetstore.unity3d.com/#/content/3779[/URL][/QUOTE] The people writing reviews do. They seem to like it.
[QUOTE=jack5500;40885530]Has anyone ported over GWEN to Unity yet?[/QUOTE] I managed to get the basics working a while back, but never got around to text rendering. [media]http://www.youtube.com/watch?v=sWZRp84CSgk[/media] It was basically just gwen-dotnet ([url]https://code.google.com/p/gwen-dotnet/[/url]) with a Unity renderer and input handler. Here's the (crappy) renderer code: [url]http://pastebin.com/XQWpdHyC[/url]
[t]http://i.imgur.com/UKNf8OO.png[/t] Smaller polygons agree/disagree? [editline]3rd June 2013[/editline] [t]http://i.imgur.com/vbNU9RS.png[/t] Turned on DoF :v:
Has anyone seen a good implementation of code-controlled spring physics in Unity? I'm trying to make sort of a spaceship equivalent to Rigs of Rods in Unity, and even with just starting out with 2D springs, I can't get it right, even when following several of the good looking tutorials on the net.
The damage model in Rigs of Rods isn't springs, neither is it in any other game I know of. Mesh deformation from damage is almost entirely inelastic and also dimensionally stable, so the model has to be a lot more complex.
[QUOTE=Tamschi;40891384]The damage model in Rigs of Rods isn't springs, neither is it in any other game I know of. Mesh deformation from damage is almost entirely inelastic and also dimensionally stable, so the model has to be a lot more complex.[/QUOTE] In rigs of rods the damage system is nodes and beams, which function essentially like springs with a constant of infinity. I'd be perfectly fine with a way of implementing a node system, too, I'm just not sure how exactly to do it, so I thought springs would be easier.
So I managed to split the world into chunks of solid meshes and it works perfect, FPS remains a solid 60 with this rendered (they're voxels, just a few issues with colouring). [t]http://i.imgur.com/UhGnAz2.png[/t] I'm stuck on something, the meshes use a shader to render the color of the individual blocks, the problem with this is that the shader removes functionality of the lights I place around the scene. So the above image is a scene with zero lights created. Is there anyway I can change this shader code to allow the lights to change the alpha of the meshes? [code] Shader "Shaders/VertexColor" { Category { BindChannels { Bind "Color", color Bind "Vertex", vertex } SubShader { Pass { } } } } [/code]
[QUOTE=Trekintosh;40892252]In rigs of rods the damage system is nodes and beams, which function essentially like springs with a constant of infinity. I'd be perfectly fine with a way of implementing a node system, too, I'm just not sure how exactly to do it, so I thought springs would be easier.[/QUOTE] The spring constant doesn't model stiffness, it's the coefficient of the negative force vs displacement. Setting it to infinity would cause undetermined/infinite force on the nodes, which doesn't make sense. You need a system where delta(beam length)/delta(t)=f(force) where f is a threshold function reflecting the materials strength.
So I wanted to play around with VisualizerStudio for Unity (music beat matching) and have made a little prototype game for Android in the last week. It includes MP3 streaming as audio clip and reading of ID3 tags. I've posted some screenshots below and is currently in it's basic alpha state on the Google Play store. Would anyone be interested in trying it out? If so I'll post some invites out. It would just push updates as I work on it and upload new versions to the store. You can play it on phone but currently I've mainly been working on it for tablets. [t]http://u.cubeupload.com/Huacati/Screenshot2013060416.png[/t] [t]http://u.cubeupload.com/Huacati/97dScreenshot2013060416.png[/t] [t]http://u.cubeupload.com/Huacati/7a2Screenshot2013060416.png[/t] Edit-> The game is a vertical shooter, orbs will drop down you have to shoot. Collect green orbs to add to score multiplier and increase shoot speed. I plan to add powerups / bad orbs eventually. If you want an invite PM me your email used for Google Play. I believe I have to invite you to a private Google+ Community which has the download link which is attached to the Alpha project on Google Play, if this is incorrect someone please let me know.
[QUOTE=Silentfood;40892602]So I managed to split the world into chunks of solid meshes and it works perfect, FPS remains a solid 60 with this rendered (they're voxels, just a few issues with colouring). [t]http://i.imgur.com/UhGnAz2.png[/t] I'm stuck on something, the meshes use a shader to render the color of the individual blocks, the problem with this is that the shader removes functionality of the lights I place around the scene. So the above image is a scene with zero lights created. Is there anyway I can change this shader code to allow the lights to change the alpha of the meshes? [code] Shader "Shaders/VertexColor" { Category { BindChannels { Bind "Color", color Bind "Vertex", vertex } SubShader { Pass { } } } } [/code][/QUOTE] You may have better luck in the shaderlab section of the unity forums, if you didn't already try there.
if I'm going to generate different terrain types, would it be a good idea to generate an array like the following 0 0 0 0 1 1 1 2 0 0 0 1 1 1 2 2 0 0 0 0 0 1 2 2 1 0 0 0 0 1 2 2 1 1 0 0 0 0 2 2 1 2 0 0 0 0 0 2 and create chunks between the number differences like this 0 0 0 0 0.5 1 1 1.5 0 0 0 0.5 0.5 1 1.5 2 0 0 0 0 0 0.5 1.5 2 1 0 0 0 0 0.5 1.5 2 1 0.5 0 0 0 0 1 2 0.5 1 0 0 0 0 0 1 assign a frequency to a enum, and let the intermediate chunks lerp between the two frequency values?
Crossposting from WDYNHW, as my questions are usually skimmed over there. [quote]So I've got extremely simple Verlet integration in unity, it works great, but I can't get colliders to work. With trigger colliders and Kinematic rigidbodies, I can sense when I hit something, but I'm not sure exactly what to do after that. Code attached [code]#pragma strict var targets : GameObject[]; private var lastX : float; private var lastY : float; var velX : float; var velY : float; var gravity : float; var restDistance : float; var tearDistance : float; var stiffness : float; var thisMass : float; private var guiVar : float; function Start () { } function FixedUpdate () { velX = transform.position.x - lastX; velY = transform.position.y - lastY; lastX = transform.position.x; lastY = transform.position.y; transform.position.x = transform.position.x + velX; transform.position.y = transform.position.y + velY+gravity; SolveLink(); guiVar = velX; } function SolveLink () { for(var point : GameObject in targets){ //We calculate the difference in position and distance var diffX = transform.position.x - point.transform.position.x; var diffY = transform.position.y - point.transform.position.y; var d = Mathf.Sqrt(diffX*diffX+diffY*diffY); //we get our distance scalar var difference = (restDistance-d)/d; //Translation of our point var translateX = diffX * 0.5 * difference; var translateY = diffY * 0.5 * difference; transform.position.x += translateX; transform.position.y += translateY; Debug.DrawLine (transform.position,point.transform.position,Color.cyan); } } function getMass (){return thisMass;} function OnGUI(){ GUI.Box(Rect(0,0,100,20),"VelX: "+guiVar); } function OnTriggerStay(){ print ("collided"); }[/code][/quote]
Managed to fix my Unity voxel issue, it wasn't a shader issue, it was because I didn't enable the fucking light. Managed to get terrain generation working too. Edit: shit forgot about the unity tags. [unity]http://nlan.org/gen/test.unity3d[/unity] Anyone know how I could improve my generation? Not as happy with it as I should be. [code] private float Perlin(float x, float z, float parentx,float parentz, float height) { float heightmapWidth = 555; float heightmapHeight = 555; x = x + parentx; z = z + parentz; float perlinValue_a = Mathf.PerlinNoise((x / (heightmapWidth/3)) * 2, (z / (heightmapHeight/3)) * 2) * (height/2); float perlinValue_b = Mathf.PerlinNoise((x / (heightmapWidth/3)) * 5, (z / (heightmapHeight/3)) * 5) * (height/2); return (perlinValue_a + perlinValue_b); } [/code]
[QUOTE=Silentfood;40941173]Managed to fix my Unity voxel issue, it wasn't a shader issue, it was because I didn't enable the fucking light. Managed to get terrain generation working too. Edit: shit forgot about the unity tags. Anyone know how I could improve my generation? Not as happy with it as I should be. [code] private float Perlin(float x, float z, float parentx,float parentz, float height) { float heightmapWidth = 555; float heightmapHeight = 555; x = x + parentx; z = z + parentz; float perlinValue_a = Mathf.PerlinNoise((x / (heightmapWidth/3)) * 2, (z / (heightmapHeight/3)) * 2) * (height/2); float perlinValue_b = Mathf.PerlinNoise((x / (heightmapWidth/3)) * 5, (z / (heightmapHeight/3)) * 5) * (height/2); return (perlinValue_a + perlinValue_b); } [/code][/QUOTE] I don't know, but I think I broke it [img_thumb]http://i.imgur.com/6IgWOIU.jpg?1[/img_thumb]
[QUOTE=EvacX;40947994]I don't know, but I think I broke it [img_thumb]http://i.imgur.com/6IgWOIU.jpg?1[/img_thumb][/QUOTE] I think that happens because I made the default character controller extremely overweight in the x and z axis.
Sorry, you need to Log In to post a reply to this thread.