Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by friketrike · Nov 05, 2012 at 01:26 AM · .objsplatmaps

I'd like to access terrain textures on a .obj terrain, any pointers?

Hi, I'm creating a demo for sound design and I want the character's steps to change according to the terrain's texture below the character (see http://answers.unity3d.com/questions/14998/how-can-i-perform-some-action-based-on-the-terrain.html , Ben Pitts' answer, since triggers would be a rather long route) but I just discovered that the level I'm using has a .obj terrain which I haven't been able to access via my C# scripts. Does anyone have a clue as to how I might go about this? I see I have access to a compiled shader but I don't really have a clue of how to modify it (assuming it's actually possible) to give me the values I'm looking for. I tried Obj2Terrain but I obtained a mesh with no textures, so it doesn't seem to be the right way. Thanks and cheers, F

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cupsster · Nov 05, 2012 at 03:49 PM 0
Share

You can raycast for pixel color or for mesh material and make decision based on that.

avatar image friketrike · Nov 05, 2012 at 04:08 PM 0
Share

Ah, that sounds good; on to learn raycasting it is :) . Thanks for the tip. Cheers

avatar image friketrike · Nov 06, 2012 at 04:39 PM 0
Share

Ok, got raycast working but I get null for the raycastHit.collider.renderer and can't find anything of much use in the debugger when I explore the raycastHit instance from the hardcoded terrain (not so from added meshes such as rocks or other props where I do get a renderer and triangleIndexes as expected). Any other ideas? Thx and cheers, F

avatar image cupsster · Nov 06, 2012 at 04:50 PM 0
Share

$$anonymous$$ake just simple planar mesh with outlines of areas projected and tag them or use simple plane with color codded info and setup raycast matrix and collision layers corespondingly. Then you can ask unity for color code or area tag and process that info..

avatar image friketrike · Nov 07, 2012 at 04:05 AM 0
Share

Ok, so I managed to make a plane under my terrain with the original terrains' splatmask and get the pixel's color value through raycasting (which I also use for detecting rock or other props that would affect the sound of footsteps). Oddly enough, the other terrain's splatmask gets imported inverted on the y axis (inverted from the original terrain, that is) and raycasting on something with a single negative scale value seems to invert coordinates within each triangle in the mesh. It's really odd, so I just created a second inverted tif and used that but if you know why this happens I'd like to find out. (to reproduce, create a plane with a white texture and scale values of 1,1,-1. Then setpixel() to Color.black under a walking FPS. Watch this in the editor from above and you'll see that the black lines are symetric to the FPS' path within each triangle). Anyhoot, thanks for your help, it's working now ;)

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why is directional light screwing up my textures? 2 Answers

Prefab Color Question 1 Answer

export sketchup to unity help 1 Answer

how to enable transparency in imported .obj surface model? 1 Answer

how to apply multiple splat maps created externally. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges