Jump to content

Does anyone have any math to translate x.y pointer events to UV mapping tp piant locally on an object?


Recommended Posts

Hi Babylonians,


I'm sorry I haven't been here much lately, but I'm burried in math hell - if there is such a place - alright, there is. :huh:


I have a painting app - will post this soon once I've rebuilt the node server ( I haven't posted yet because multiuser is the main point).  But I'm continuing to build on our old server to add features to test.  So, here is the question - Does anyone have any math to translate x.y pointer events to UV mapping coodinates to piant locally on an object?  I currently have the old standards working (unwrap UVs and paint on a plane to reflect the 3D objects UVs.)  However, I'm sure there is a way to unwrap the UVs based upon the object your unwraping to allow real time painting locally from the 2D canvas to a dynamic texture.  I can work the math on a specific object, but that's not good enough. Any thoughts from the brainiacs here?



Link to comment
Share on other sites

How come almost no one ever answers my questions?  Do I ask really stupic, rediculous questions?  :wacko: OK, that was a stupid question.  :huh:


So I'll re-ask. I need to fire a ray (vector) from my canvas and if it intersects an object with a dynamic texture attached, it will return the UV vertex coordinates.  I can then build an array to translate these.  THis will then allow us ALL to paint DIRECTLY on an object without distortion. Hello, Beuler?  :blink:

Link to comment
Share on other sites

pfft, I was about to bust open Samac just to try to find an answer to your question, dbawel.  You friggin' whiney-ass impatient Californian!  :D


Secondly, you ask hard questions.


Third, yes, you talk a bit weird, but I do as well, so I guess you avoided a noogie there.  :)


Fourth, learn to type.  "Do I ask really stupic, rediculous questions?"  No, you don't ask stupid or ridiculous questions, but California is going 4 times the speed of the rest of the planet.  They still have money out there.  The rest of America is pretty much on hold.  You might be trying to eat off-of BJS... and that could cause hurrying.  We understand.  But for many of us, BJS and the forum... is a hobby and high-tech social club.  :)


Don't make me have to make you have to make something of yourself.


But, ok, decals.  You were in the decals thread with us.  You saw how DeltaK was able to align these decals... onto the angles of the 5-sided cylinder in those PG demos.  Your paint brush tip will need to do the same.  In fact, why not start with that.  Turn on the .showBoundingBox of a texture-less decal, disable decal clicks, hook the brush to the pointer, and see if you can get the decal/brush to flat-track on the angles of a 5-side cylinder... as you mouse the decal/brush over its surface.  I think there's code in decals... that you could use.  Go dig some source, you whiney POS.  :)


hehe... I'm just having fun, and so were you, I hope.  You need to EARN your whiner's license, just like the rest of us.  :)


Didja know that Jerome had 4823 questions go un-answered, and STILL didn't whine a single drop?  Amazing.  But Jerome is actually not human.  He's an Orthogonoid... from the planet Orthogona. 


Oh yeah, and thanks for the tip/lead, RaanMan!  getTextureCoordinates, cool.  See DB?  Raany digs source, like a man.  heh


PS: DB, I once mentioned to you... that the DOM context2D class/object... is "the goods" that live behind our dynamicTextures.  Ever heard of SVG?  Well the DOM context 2D object is essentially SVG... strokes, fills, lines, circles, etc.  Go do a web search for it, and know that you must learn that object like the back of your hand... to do good dynamic texture painting.  Think you can learn it on your own, or will you need babysitting?  heh.

Link to comment
Share on other sites

It sounds like PickingInfo.getTextureCoordinates() took your requirements a even step farther beyond UV right to the 2D location in the texture to change the color of.  PickingInfo is kind of a cryptic class with no comments, & externally set 2 letter members, but if it works.  It really could use a constructor to set its members.


FYI, you are the "math" guy here.  Never put the word math in your own questions.  That will scare off pretty much everybody.  Also, questions that are not simple need a lot time to answer, especially on the weekends.


Hopefully you can plug this right into your "virtual graffiti" project.  I feel the urge to paint a moustache on a statue.

Link to comment
Share on other sites

Ooh... I guess I deserved that.  Wow... relentless.   :o   Lot's of good ideas here.  I'll look at all of them.  And I'm certainly not the math guy, just a bit of a psycopath who would like to believe he get's it.  OK, that was in the 3rd person.  I need to check back into the padded room now.  :blink:

Link to comment
Share on other sites

haha.  Don't take it heavy, DB.  I'm pretty sure all of us like having you around, no matter what.  "Tact" is different, person to person, country to country.  It's difficult to transmit the facial expressions and body language... in text... so it takes seemingly forever to get to know people (imho).  I jokingly call user issues... "customer service requests" but... it's really pretty difficult to give forum users THAT level of "courtesy".  I often try to give the most time... to the most confused or most new... folks that could MAYBE benefit from my lonnnnnnng heavily-reiterated explanations.


You're not one of those, DB.  You're actually VERY intelligent, and I know you can "hack" and "grind".  The real question... are you lonely?  Do you love collaboration and deep analysis, over coffee?  I am, and I do.  All these forum users... including you, DB... are my heroes.  I love hanging out with you guys and participating in "the juices".  Sometimes I'm harsh... and I hope I didn't hurt your feelings, DB.  None of my comment was meant to do so, but... it WAS meant to playfully roll you around in the mud for a fun minute.  My comments were meant to be funny... but... I've heard that I go over the line sometimes, and sometimes folks can't tell if I'm joking or serious.  Sometimes I hurt people. 


I DO like having you around, DB.  Don't go anywhere.  The experts here... don't necessarily speak perfect English.  Keep your comments short, questions-per-post low, show playgrounds of the issue, and be patient.  Essentially, make your posts look absolutely nothing like a Wingnut post, and folks will take notice.  :D


Besides, it's summer... the forum is slow due to playing in the sun, right?  You bet.  Now cowboy-up to the bar, and I'll pour us some whiskey.  :)  Who's with us?

Link to comment
Share on other sites

It's all good Wingnut.  Whenever I need a little comic relief on the BJS frum, I just look for one of your posts; as you always seem to find a unique way of looking at things.  And Humble, you are - to a fault.  But that's a good character trait.


I doubt few people get offended here, as we're all pretty thick skinned.  Just keep those posts coming, and we'll all grow together to find ourselves WebGL Utopia. :D

Link to comment
Share on other sites

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...