GithubHelp home page GithubHelp logo

Comments (6)

nickcastel50 avatar nickcastel50 commented on June 6, 2024 2

Okay @MarekKowalski, I got it rendering on the iPhone! Since I removed the gesture control code, I had to rotate the camera Y axis 180 degrees to see it. That shader is still an issue though, it just renders depth, it doesn't render color at all.

Also one other thing, the background is black. Would you know would I go about making the background transparent and having the background be my phone's camera feed for some sort of AR experience? Thanks again for your help and project!

Edit: I found this thread which has some great conversation on the issue: https://forum.unity.com/threads/ios-11-metal2-has-no-geometry-shader.499676/

So in short, Apple doesn't support Geometry shaders. Admittedly I don't know much about building shaders, I am not sure how get the same functionality from your Geometry shader using Compute shaders. If you could shed some light on this it would be greatly appreciated!

Double Edit: I modified the shader to use the color from the application. It doesn't do the triangle geometry but I will have to look into modifying the shader to do the geometry with compute code.

Here is the shader code:

// Don't remove the following line. It is used to bypass Unity
// upgrader change. This is necessary to make sure the shader 
// continues to compile on Unity 5.2
// Created by Team Tango
// Modified by Nick Castellucci to preserve color on iOS for
// LiveScan3D
// UNITY_SHADER_NO_UPGRADE
Shader "Tango/PointCloud" {
Properties{
        point_size("Point Size", Float) = 5.0
}
  SubShader {
     Pass {
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
       
        #include "UnityCG.cginc"

        struct appdata
        {
           float4 vertex : POSITION;
           // add color here because livescan3d transmits it
           float4 color : COLOR;
        };

        struct v2f
        {
           float4 vertex : SV_POSITION;
           float4 color : COLOR;
           float size : PSIZE;
        };
       
        float4x4 depthCameraTUnityWorld;
        float point_size;
       
        v2f vert (appdata v)
        {
           v2f o;
           o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
           o.size = point_size;
           
           // Use color from appdata
           o.color = v.color;
           return o;
        }
       
        fixed4 frag (v2f i) : SV_Target
        {
           return i.color;
        }
        ENDCG
     }
  }
}

from livescan3d-hololens.

MarekKowalski avatar MarekKowalski commented on June 6, 2024

Hi,

I had an email from someone who had a similar issue previously, he used this shader:
https://github.com/googlearchive/tango-examples-unity/blob/master/UnityExamples/Assets/TangoPrefabs/Shaders/PointCloud.shader

And apparently he got it working on an iPhone 8.

Let me know if it worked!

Marek

from livescan3d-hololens.

nickcastel50 avatar nickcastel50 commented on June 6, 2024

Thank you @MarekKowalski! I will try this and report back. I think I still have an error to fix, I was getting a black screen on iOS after the Unity logo appears and the logs say "SocketException:Connection Refused". This is strange to me because on the PC where I am running the server I see that the port connection is established and looking at Wireshark logs I can see the point cloud stream is being sent to my phone's IP over port 48002.

I thought even with the bad shader it should still render, albeit just a solid pink color? Maybe I'm wrong, will let you know as soon as I try with the shader you provided. Thanks again!

from livescan3d-hololens.

TheBricktop avatar TheBricktop commented on June 6, 2024

How did You manage to autoconnect at start, it always freezes my editor when I try to get it like this

from livescan3d-hololens.

MarekKowalski avatar MarekKowalski commented on June 6, 2024

@nickcastel50, congratulations on your progress and sorry I did not answer, for some reason I missed your post completely :( Unfortunately I know little a bout shaders as well, so I won't be able to help you there. Your project sounds quite interesting, please post more info about your progress or maybe show a video.

@TheBricktop , have you made sure the live view window is open and showing the point cloud (on the same device as Unity)? If you did and it does not work, please check your firewall settings.

Marek

from livescan3d-hololens.

nickcastel50 avatar nickcastel50 commented on June 6, 2024

How did You manage to autoconnect at start, it always freezes my editor when I try to get it like this

@TheBricktop: You can just just modify the KeyboardInput.cs file in @MarekKowalski's project. Just call keyboardDone.invoke(YOUR_IP_ADDRESS); in the start() function. It works fine for testing.

Something like this:

void Start ()
    {
        if (keyboardDone != null)
            keyboardDone.Invoke(YOUR_IP_ADDRESS);
    }
	
void Update ()
    {
     
    }

from livescan3d-hololens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.