Unity plus kinect2.0 taking photos and using RPC image transfer to create photo wall issues

Source: Internet
Author: User

Photo issue solved in Saturday, is to get Kinect color pictures, and then converted into texture2d can

Then is the picture transmission problem, because requires each computer to install a kinect2.0, and each computer opens a client,

Then a service side is the photo wall function, so the photo wall of the one to do the server, to handle the accepted pictures


The main problem here is how to upload pictures

At first, I thought of the socket, but it was very complicated to think of the whole

So I want to solve some problems with unity.


Of course, after the smooth Cheng Zhang met the RPC

RPC (remote Procedure call Protocol)-a remoting protocol that requests services from a remote computer program over a network without needing to know the underlying network technology.

RPC is actually a C/s programming mode, a bit like the C/ssocket programming mode, but it is more layer than it. When we set up the RPC service, the client's invocation parameters pass through the underlying RPC transport channel, either UDP or TCP (or ti-rpc-independent), and go to the appropriate RPC application based on the destination address and the RPC upper application number provided before the transfer. Porgramme Server


RPC definition
[RPC]
void RequestMessage2 (String message, Networkmessageinfo info)
{
Message network request to send the content, this can be handled by itself
Networkmessageinfo keeps the details of who sent this RPC, the number of arguments before this and the parameter type must be the same as the parameter when the RPC is executed can be string byte[] and so on Networkmessageinfo can not write this parameter
Message + = "\ n" + "sender" + Info.sender + ":" + message;
}
Call RPC
Getcomponent<networkview> (). RPC ("RequestMessage2", Rpcmode.all, InputMessage);
Parameter RequestMessage2 is the method that accepts the message, and the method must have an RPC identity
Parameter two Rpcmode send mode has
server sends to servers
Others sends each client except itself (including the server)
Otherbuffered
All
Allbuffered
Parameter three inputmessage must match the first parameter type of the RPC definition function



And then write the same RPC function on both the server and the client to define the same

And then it's ready to send.

First need to convert texture2d to byte[] form, using a lazy method, because the direct reading of the picture is byte[] form, so the test

byte[] ImageData = file.readallbytes ("X:/x.png");

Then send byte[] Data

After the server receives the direct encode to the PNG to assign in the object material map to be possible

Note that local send pictures and encode are quick

But the local area network is very slow, need to delay encode and give the object, otherwise the map is a question mark


To provide a link to some of the solutions that I have inspired.

Http://answers.unity3d.com/questions/758155/send-texture-over-network.html

Http://answers.unity3d.com/questions/190340/how-can-i-send-a-render-texture-over-the-network.html

Http://answers.unity3d.com/questions/54424/sending-bulk-data-via-rpc.html

Http://answers.unity3d.com/questions/159109/sending-array-over-the-network-and-onserializenetw.html

Http://answers.unity3d.com/questions/829757/how-do-i-send-an-array-over-the-network.html

Http://answers.unity3d.com/questions/142751/streaming-textures-possible.html

http://forum.unity3d.com/threads/unity5-beta-webgl-unity-websockets-plug-in.277567/



In addition, the RPC method is actually outdated, in the unity5.1 when there is a new system, higher than the attention of a different version can try

It seems to provide a lot of methods, but also to operate from the bottom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.