[QUOTE=nVidia;41482474]I've heard nGui is great.[/QUOTE]
It looks pretty good. Unfortunately the small team I'm part of can't really afford the price tag, anything cheaper/free that is comparable?
So I need help, I'm trying to load an assload of 7552x552 images to stream at 60fps onto a plane. My problem is I'm not sure how to load them just one or two at a time, as loading all of them slightly crashes Unity (there's about 24,500). How can I manage them in a somewhat more convenient way? (no, putting them in an actual video is worse, as the video I extracted them from is 30GB) I tried using Resource.Loadall and that was bad.
[QUOTE=Trekintosh;41510822]So I need help, I'm trying to load an assload of 7552x552 images to stream at 60fps onto a plane. My problem is I'm not sure how to load them just one or two at a time, as loading all of them slightly crashes Unity (there's about 24,500). How can I manage them in a somewhat more convenient way? (no, putting them in an actual video is worse, as the video I extracted them from is 30GB) I tried using Resource.Loadall and that was bad.[/QUOTE]
why would you ever need to do this. how many of them do you need loaded at once?
[QUOTE=Kybalt;41510979]why would you ever need to do this. how many of them do you need loaded at once?[/QUOTE]
MY job, and only 1 or 2 at a time, just depends on how quickly I can load one. If I can load sixty a second, that works fine for loading one at a time, if not I might have to load chunks of files. They're only ~120kb each
EDIT:
While I wait for Unity to finish ingesting 24,600 images, here's the code I came up with. Does anyone see a problem with it?
[CODE]#pragma strict
var Video : Texture2D;
var Index = 0;
var IndexString : String;
function Start(){
}
function FixedUpdate{
if(Input.GetKey(KeyCode.E)){
Index +=1;
//All this bullshit is just to add the zeros we need for the images' name
if(Index <10){
IndexString = "0000"+Index.ToString();
}
else if(Index <100){
IndexString="000"+Index.ToString();
}
else if(Index<1000){
IndexString="00"+Index.ToString();
}
else if(Index<10000){
IndexString="0"+Index.ToString();
}
else {IndexString=Index.ToString();}
}
Video = Resources.Load("FSE_Video/Bon Jovi/JPEG/"+IndexString);
this.renderer.material.mainTexture = Video;
}
[/CODE]
[QUOTE=Trekintosh;41511373]MY job, and only 1 or 2 at a time, just depends on how quickly I can load one. If I can load sixty a second, that works fine for loading one at a time, if not I might have to load chunks of files. They're only ~120kb each
EDIT:
While I wait for Unity to finish ingesting 24,600 images, here's the code I came up with. Does anyone see a problem with it?
[CODE]#pragma strict
var Video : Texture2D;
var Index = 0;
var IndexString : String;
function Start(){
}
function FixedUpdate{
if(Input.GetKey(KeyCode.E)){
Index +=1;
//All this bullshit is just to add the zeros we need for the images' name
if(Index <10){
IndexString = "0000"+Index.ToString();
}
else if(Index <100){
IndexString="000"+Index.ToString();
}
else if(Index<1000){
IndexString="00"+Index.ToString();
}
else if(Index<10000){
IndexString="0"+Index.ToString();
}
else {IndexString=Index.ToString();}
}
Video = Resources.Load("FSE_Video/Bon Jovi/JPEG/"+IndexString);
this.renderer.material.mainTexture = Video;
}
[/CODE][/QUOTE]
Besides the lack of indenting,
[code]function FixedUpdate{[/code]
seems like it might cause some problems. And concatenating strings takes a shitload of memory, so if you're going to do it 24,600 times you might want to look at a different way.
[editline]19th July 2013[/editline]
I'm also not quite sure why it's in a FixedUpdate. Why would you not want to do this every frame, but every physics timestep?
I'm also not quite sure why you're requiring a key press, but I don't really know what's going on anyways :v:
[QUOTE=Asgard;41517894]Besides the lack of indenting,
[code]function FixedUpdate{[/code]
seems like it might cause some problems. And concatenating strings takes a shitload of memory, so if you're going to do it 24,600 times you might want to look at a different way.
[editline]19th July 2013[/editline]
I'm also not quite sure why it's in a FixedUpdate. Why would you not want to do this every frame, but every physics timestep?
I'm also not quite sure why you're requiring a key press, but I don't really know what's going on anyways :v:[/QUOTE]
FixedUpdate is just to keep the framerate constant, that's all. Key press is mainly for debugging purposes, so I can stop and start to test how memory load affects the loading.
You're probably right about the strings, it's running incredibly slowly. Any suggestion on a different method of doing it?
[QUOTE=Trekintosh;41523440]FixedUpdate is just to keep the framerate constant, that's all. Key press is mainly for debugging purposes, so I can stop and start to test how memory load affects the loading.
You're probably right about the strings, it's running incredibly slowly. Any suggestion on a different method of doing it?[/QUOTE]
String concatenation is negligible here. You aren't meant to be loading a shitload of images to the memory every single frame. Why aren't you using actual video instead?
[QUOTE=DarKSunrise;41528084]String concatenation is negligible here. You aren't meant to be loading a shitload of images to the memory every single frame. Why aren't you using actual video instead?[/QUOTE]
Because it requires Unity Pro?
[editline]20th July 2013[/editline]
You could play it as a seperate file of course, there's no real need for it to be in your game
[QUOTE=DarKSunrise;41528084]String concatenation is negligible here. You aren't meant to be loading a shitload of images to the memory every single frame. Why aren't you using actual video instead?[/QUOTE]
Well the actual video is [B]30GB[/B], just importing it into the Unity Editor takes hours and it won't even work. That and it requires Unity Pro.
[QUOTE=Asgard;41530632]Because it requires Unity Pro?
[editline]20th July 2013[/editline]
You could play it as a seperate file of course, there's no real need for it to be in your game[/QUOTE]
We really do need it in the game, there's no easy way to get what we need out of it besides in a game.
[QUOTE=Trekintosh;41533600]Well the actual video is [B]30GB[/B], just importing it into the Unity Editor takes hours and it won't even work. That and it requires Unity Pro.[/QUOTE]
And why can't you compress it? 30 GB is ridiculous.
[QUOTE=Chris220;41533661]And why can't you compress it? 30 GB is ridiculous.[/QUOTE]
It's quite heavily compressed already, 7552x552@60fps for 7 minutes.
[QUOTE=Trekintosh;41533698]It's quite heavily compressed already, 7552x552@60fps for 7 minutes.[/QUOTE]
Apologies if you've already said because I haven't read the entire thing, but what exactly do you need this for? It sounds like a very unusual thing to do and I can't help feeling there's a much better way of doing it.
I have this bit of code in OnGUI()
[code]if ( Event.current.type == EventType.Repaint )
{
int screenHeight = Screen.height;
int screenWidth = Screen.width;
float posX = ( ( screenHeight / 2 ) + 70 ) / screenHeight;
float posY = 90 / screenWidth;
float width = ( ( screenWidth / 2 ) - 145 ) / screenWidth;
Debug.Log(posX + ", " + posY + ", " + width + ", 0.4 | " + screenWidth + "x" + screenHeight);
landerCam.rect = new Rect(posX, posY, width, 0.4f);
landerCam.Render();
}[/code]
Why are my [I]posX[/I], [I]posY[/I], and [I]width[/I] variables are all coming out 0?
[editline]21st July 2013[/editline]
And of course, one minute after I post, I figure out how to fix it. I changed my [I]int screenHeight[/I] and [I]int screenWidth[/I] variables to floats and it worked.
[editline]21st July 2013[/editline]
-snip-
figured it out. I was just being dumb
Decided that I don't like the cheaper Gui solutions for Unity, and couldn't afford the more expensive solutions, so... attempting to bind (or rather, port) Gwen.Net to unity.
[img]http://i.imgur.com/tYHrIUK.png[/img]
That's sweet! It's something I've been thinking of doing ever since I started using ngui!
[QUOTE=Chris220;41533917]Apologies if you've already said because I haven't read the entire thing, but what exactly do you need this for? It sounds like a very unusual thing to do and I can't help feeling there's a much better way of doing it.[/QUOTE]
[img]http://0.tqn.com/d/govegas/1/0/A/O/1/fremontexp8.jpg[/img]
See this? It's the Fremont Street Experience in Las Vegas. I'm tasked with recreating it in Unity so we can test how our new renders look on the curved screen, as it's nearly impossible to picture without a visual representation. The stupid thing is a 7552x552 quarter-mile-long video display, the largest in the world. We play music videos on it, and often our production process could be much streamlined if instead of having to fly essentially all the animators out to LV to preview it on the real thing, we could just dump the image sequence in the game and test it out there. It's about more than just rendering it out in a modeling program too, we need to be able to see it at different angles and directions in real time. So yeah, that's what I'm trying to do.
I'm not that well versed with Unity, but in general, I'd say create a circular buffer of texture objects, say, 100-200, to account for hard drive seek time. At a regular framerate, step through the buffer and show the next texture. As this is happening, there should be another thread reading in images from disk and updating the texture data. This gives you a bit of a buffer.
But if removing the overhead of creating new textures isn't enough to be able to load an image in less than 16ms on average, then I'd recommend you take those images, run them through a tool to generate an actual video, and play that in Unity. A compressed video will be a LOT smaller than a sequence of JPEGs and has none of that extra filesystem overhead.
[QUOTE=Trekintosh;41544658]See this? It's the Fremont Street Experience in Las Vegas. I'm tasked with recreating it in Unity so we can test how our new renders look on the curved screen, as it's nearly impossible to picture without a visual representation. The stupid thing is a 7552x552 quarter-mile-long video display, the largest in the world. We play music videos on it, and often our production process could be much streamlined if instead of having to fly essentially all the animators out to LV to preview it on the real thing, we could just dump the image sequence in the game and test it out there. It's about more than just rendering it out in a modeling program too, we need to be able to see it at different angles and directions in real time. So yeah, that's what I'm trying to do.[/QUOTE]
Isn't there some way to stream the video from disk, without actually loading the whole thing at once?
[QUOTE=Trekintosh;41544658]~awesomeness~[/QUOTE]
Okay, that's a lot more epic than what I was expecting.
And here I was thinking it was a guy making a game who had no idea what he was doing as was trying to do something stupid. :v:
I think that actually comes under the 'unusual' part of my last post.
How can I get an object to look at another while only rotating around the z-axis? And staying at position.z = 0?
[editline]21st July 2013[/editline]
Or, how can I limit the rotation rate of transform.lookat?
Got mouse input to work. Kinda cross-posting between here and waywo, I guess it's more relevant here but waywo gets more traffic.
[media]http://www.youtube.com/watch?v=HhEHccin_qU[/media]
Gonna have a stab at text rendering next, then making sure it all works via the unit tests.
[QUOTE=Pelf;41547886]How can I get an object to look at another while only rotating around the z-axis? And staying at position.z = 0?
[editline]21st July 2013[/editline]
Or, how can I limit the rotation rate of transform.lookat?[/QUOTE]
Use Quaternion instead of Transform.LookAt.
From [url=https://gist.github.com/tracend/893624]this[/url],[url=http://forum.unity3d.com/threads/36377-transform-LookAt-or-Quaternion-LookRotation-on-1-axis-only]this[/url], and [url=http://forum.unity3d.com/threads/40866-how-to-constrain-the-quot-transform-LookAt-quot-on-Y]this[/url]:
[code]
Quaternion rotateTo = Quaternion.LookRotation(target.position - transform.position);
//Lock rotation by setting the axis to 0
//rotateTo.x = 0
//rotateTo.y = 0
//rotateTo.z = 0
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
[/code]
You could also use Vector3.Lerp with Transform.LookAt I guess, as it accepts either Transform or Vector3 as target.
[QUOTE=Pelf;41547886]How can I get an object to look at another while only rotating around the z-axis? And staying at position.z = 0?
[editline]21st July 2013[/editline]
Or, how can I limit the rotation rate of transform.lookat?[/QUOTE]
It's much cleaner to get the Quaternion.LookRotation.
[CODE]
Vector3 newRotation = Quaternion.LookRotation(target);
transform.rotation.z = newRotation.z;
[/CODE]
:)
[QUOTE=secundus;41550131]Use Quaternion instead of Transform.LookAt.
From [url=https://gist.github.com/tracend/893624]this[/url],[url=http://forum.unity3d.com/threads/36377-transform-LookAt-or-Quaternion-LookRotation-on-1-axis-only]this[/url], and [url=http://forum.unity3d.com/threads/40866-how-to-constrain-the-quot-transform-LookAt-quot-on-Y]this[/url]:
[code]
Quaternion rotateTo = Quaternion.LookRotation(target.position - transform.position);
//Lock rotation by setting the axis to 0
//rotateTo.x = 0
//rotateTo.y = 0
//rotateTo.z = 0
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
[/code]
You could also use Vector3.Lerp with Transform.LookAt I guess, as it accepts either Transform or Vector3 as target.[/QUOTE]
This makes my object spin and it doesn't constrain its position on the z axis to 0.
[editline]22nd July 2013[/editline]
[QUOTE=Duskling;41551778]It's much cleaner to get the Quaternion.LookRotation.
[CODE]
Vector3 newRotation = Quaternion.LookRotation(target);
transform.rotation.z = newRotation.z;
[/CODE]
:)[/QUOTE]
And this doesn't work because newRotation needs to be a Quaternion and I can't directly modify transform.position.z
[editline]22nd July 2013[/editline]
I decided to forget using the LookAt, RotateTowards and other unity functions and just program a system from scratch:
[code]void RotateMissile()
{
Vector3 targetVector = target.position - transform.position;
Vector3 forwardVector = transform.forward;
float angle = Vector3.Angle(forwardVector, targetVector);
if ( angle >= 4 )
{
int rotModifier = AngleDirection(transform.forward, targetVector, transform.up);
float rotation = maxRotation * Time.fixedDeltaTime * rotModifier;
transform.Rotate(0, 0, rotation, Space.World);
}
}
int AngleDirection( Vector3 forward, Vector3 targetDir, Vector3 up )
{
Vector3 perp = Vector3.Cross(forward, targetDir);
float dir = Vector3.Dot(perp, up);
if ( dir > 0f )
{
return 1;
}
else if ( dir < 0f )
{
return -1;
}
else
{
return 0;
}
}[/code]
So now I just call RotateMissile() from FixedUpdate() and everything seems to work out. With this I can rotate around any single axis just by moving [I]rotation[/I] in the transform.Rotate() function.
[QUOTE=Pelf;41551945]
And this doesn't work because newRotation needs to be a Quaternion and I can't directly modify transform.position.z[/QUOTE]
My bad. This should probably work well for you.
[CODE]
Quaternion newRotation = Quaternion.LookRotation(target);
transform.rotation = new Quaternion(transform.rotation.x, transform.rotation.y, newRotation.z, transform.rotation.w);
[/CODE]
But if your own solution works well, then that's good too.
[url=http://unity3d.com/unity/whats-new/unity-4.2]Unity 4.2 was released.[/url]
Among other things, it makes realtime shadows free (limited to a single directional light with hard shadows though) along with text-based asset serialization (for making version control actually useable).
And still no Linux editor or webplayer!
Yeah it's weird you'd think they'd put the platform with the lowest share of desktop users at the top of their list to add support for.
Unity seems great--however i really don't know how to start with this.
Sorry, you need to Log In to post a reply to this thread.