SteamVR Developer Hardware

SteamVR Developer Hardware

»Mr_FJ« 26 May, 2016 @ 6:32am
Replacing the controller texture/model IN Unity?
Hey, how can I use a custom controller texture in my Unity game? I've tried disabling the existing model loader script, and adding the model, with my own texture, but then I lose all the touchpad and button tracking stuff. I just want to replace the texture of the controler (And if possible, add to the model)

Edit: Sometimes the most simple solution, is the right one. I rotated the texture 180degrees, then flipped it horizontally. It fits now! SOLVED!

Here's the script I ended up using: http://pastebin.com/ihcxi39x Don't forget to rotate and flip your texture!

Edit 28-09-2018: Check out chunk_split's github for an improved solution: https://gist.github.com/patricknelson/2696f245f3b744b7c8a1a26921701191
Last edited by »Mr_FJ«; 27 Sep, 2018 @ 3:45pm
< >
Showing 1-15 of 17 comments
Fauxnetic 26 May, 2016 @ 4:54pm 
I too am having the same issue. Once I disable to RenderModel component on the original model, I keep tracking and all, just all input no longer works. It doesn't make sense to me, seeing that controls are not wired to RenderModel at all, unless I'm just a noob, which...I am.
»Mr_FJ« 27 May, 2016 @ 12:15am 
Originally posted by The Crab:
I too am having the same issue. Once I disable to RenderModel component on the original model, I keep tracking and all, just all input no longer works. It doesn't make sense to me, seeing that controls are not wired to RenderModel at all, unless I'm just a noob, which...I am.

Yeah, it's because the RenderModel script loads the model, from your local SteamVR installation folder, then splits it up into parts and stuff. It does the same with the texture, that's why it's hard to figure out where to inject the texture - It's not a Texture2D, until after a lot of of stuff has been done to it.
Last edited by »Mr_FJ«; 27 May, 2016 @ 12:38am
Lindsay Jorgensen 27 May, 2016 @ 2:34am 
RenderModel script sends and event you can listen for (something like :

"SteamVR_Utils.Event.Listen("render_model_loaded",<Function>);" )

after which you can go in and change the materials or parts at will.

This isn't making the script load from obj like the controller worksop modding, but it's unity, so you can just set the meshfilter to a different mesh if you want, or link stuff on instead.

I have a clunky little bit of code that goes in and matches parts by name, which hasn't been bad so far, so fingers crossed.
Names are:
new string[]{"base","body","button","trackpad","trackhat","lgrip","rgrip","trigger","trackpad_touch"};
»Mr_FJ« 27 May, 2016 @ 4:23am 
Originally posted by Lindsay Jorgensen:
RenderModel script sends and event you can listen for (something like :

"SteamVR_Utils.Event.Listen("render_model_loaded",<Function>);" )

after which you can go in and change the materials or parts at will.

This isn't making the script load from obj like the controller worksop modding, but it's unity, so you can just set the meshfilter to a different mesh if you want, or link stuff on instead.

I have a clunky little bit of code that goes in and matches parts by name, which hasn't been bad so far, so fingers crossed.
Names are:
new string[]{"base","body","button","trackpad","trackhat","lgrip","rgrip","trigger","trackpad_touch"};

But RenderModel has changed the texture by that point (Reordered the pixels or something? The code looks pretty confusing to me). When I tried adding the new texture (A recolor of the one found in the SteamVR installation folder) after RenderModel is done, it didn't fit at all! So I need to inject it before the changes...

EDIT: Okay I get what you mean. I think I can make this work.
Last edited by »Mr_FJ«; 27 May, 2016 @ 6:04am
»Mr_FJ« 29 May, 2016 @ 2:26pm 
Crap, the texture is still offset. I need to figure out what the script does to the texture, before applying it. It just looks so confusing...
Last edited by »Mr_FJ«; 29 May, 2016 @ 2:26pm
»Mr_FJ« 30 May, 2016 @ 7:07am 
Sometimes the most simple solution, is the right one. I rotated the texture 180degrees, then flipped it horizontally. It fits now! SOLVED!

Here's the script I ended up using: http://pastebin.com/ihcxi39x Don't forget to rotate and flip your texture!
Last edited by »Mr_FJ«; 30 May, 2016 @ 8:37am
Earl Sagan 4 Jan, 2017 @ 4:45pm 
This script was using a lot of CPU resources for me (around %10 of total CPU usage), because of this line
SteamVR_Utils.Event.Listen("render_model_loaded", OnControllerLoaded);
in Update().

I moved it to Start() and it works fine and there's no more CPU overhead. Here's a link to the updated script: http://pastebin.com/ShJFcfnn
aaron.leiby  [developer] 4 Jan, 2017 @ 6:40pm 
I recommend performing SteamVR_Utils.Event.Listen in OnEnable, and then a symmetric SteamVR_Utils.Event.Remove in OnDisable.
»Mr_FJ« 5 Jan, 2017 @ 12:18pm 
Originally posted by Earl Sagan:
This script was using a lot of CPU resources for me (around %10 of total CPU usage), because of this line
SteamVR_Utils.Event.Listen("render_model_loaded", OnControllerLoaded);
in Update().

I moved it to Start() and it works fine and there's no more CPU overhead. Here's a link to the updated script: http://pastebin.com/ShJFcfnn


Originally posted by aaron.leiby:
I recommend performing SteamVR_Utils.Event.Listen in OnEnable, and then a symmetric SteamVR_Utils.Event.Remove in OnDisable.

Good call guys! Must've slipped my mind back then. I updated my script.
Last edited by »Mr_FJ«; 5 Jan, 2017 @ 12:23pm
Earl Sagan 28 Feb, 2017 @ 1:17am 
Updated for SteamVR plugin version 1.2.1 and now featuring normal, specular and metallic maps: https://gist.github.com/TrebuhD/d85e288adefd75899b7d8fb285952cb8
Last edited by Earl Sagan; 28 Feb, 2017 @ 1:18am
»Mr_FJ« 4 Mar, 2017 @ 5:26am 
Originally posted by Earl Sagan:
Updated for SteamVR plugin version 1.2.1 and now featuring normal, specular and metallic maps: https://gist.github.com/TrebuhD/d85e288adefd75899b7d8fb285952cb8

Cool, good job! Hope oyu don't mind I shared this on my reddit thread: https://www.reddit.com/r/Vive/comments/4lpfdc/replacing_the_vive_controlelr_texture_in_unity/
Last edited by »Mr_FJ«; 4 Mar, 2017 @ 5:30am
eljaydub 12 Apr, 2017 @ 2:59pm 
I'm working on replacing the render models in my code with
var part = controllerTransform.Find("body"); part.GetComponent<MeshFilter>().mesh = newMesh.mesh;
but no matter what my rotation is in my modelling program (I've tried with Maya and Blender with many various rotations applied) the model I use to replace the default model ends up rotated by 180 (see example screenshot here,[imgur.com] note the modified body model is flipped 180 relative to the unmodified buttons).
It's very strange that no matter what the rotation of the mesh I put in from my 3d modelling software, I always get the same orientation out (the flipped 180 one).
I'm not a 3d modeller so it's possible I'm doing something wrong in the Maya and Blender, however I am aware of the differences in coord systems and how to compensate so I don't think that's it.
Did anyone else have a problem like this?
Last edited by eljaydub; 12 Apr, 2017 @ 3:01pm
»Mr_FJ« 15 Apr, 2017 @ 12:08pm 
Originally posted by eljaydub:
I'm working on replacing the render models...

That's odd! I'm really busy at work as of late, but if I don't forget, I'll look at the model I've used and try to give you some pointers.
Deanna 2 Jul, 2017 @ 4:33pm 
If it helps anyone, I just noticed VRTK (vrtk.io) comes with an example scene showing how to change the controller model. Their new model even animates on button press.


Currently the example scene is VRTK/Examples/032_Controller_CustomControllerModel
»Mr_FJ« 9 Jan, 2018 @ 4:19am 
Originally posted by eljaydub:
I'm working on replacing the render models in my code with
var part = controllerTransform.Find("body"); part.GetComponent<MeshFilter>().mesh = newMesh.mesh;
but no matter what my rotation is in my modelling program (I've tried with Maya and Blender with many various rotations applied) the model I use to replace the default model ends up rotated by 180

...

Did anyone else have a problem like this?

If you're still looking for an answer, you might need to Reset XForms in Maya :)
< >
Showing 1-15 of 17 comments
Per page: 1530 50

Date Posted: 26 May, 2016 @ 6:32am
Posts: 17