Implement a UV-mapping callback for extruded sketches (EXTRUDE)BRL-CAD
Status: ClosedTime to complete: 100 hrs Mentors: Harmanpreet, DishankTags: C, code, programming, mapping, callback, graphics, math

BRL-CAD provides more than two dozen types of geometry ''primitives'' such as ellipsoids, boxes, and cones. Every primitive is described by a collection of callback functions, for example rt_ell_bbox() returns the bounding box dimensions for an ellipsoid. One of those functions describes a UV mapping of the object's surface, which is used for things like texture and bump mapping. An example of this is rt_ell_uv() in the src/librt/primitives/ell/ell.c source file for an ellipsoid. Several of our more complex primitive types (such as BoT, NMG, and BREP/NURBS) do not presently implement a UV-mapping function leading to unexpected runtime behavior.

References:

  • http://en.wikipedia.org/wiki/UV_mapping
  • src/librt/primitives/[PRIMITIVE]/[PRIMITIVE].c, read the rt_*_uv() function

Code:

  • src/librt/primitives/extrude/extrude.c (implement the uv-mapping callback here)
  • src/librt/primitives/table.c (add a reference to your function here)
  • include/rtgeom.h

This task involves implementing a UV-mapping callback for any of the primitives that do not already have a functional UV-callback defined. Note that this is an advanced task that might take you more than a couple hours if you don't have solid coding skills, but it's ultimately just a few lines of code. See other primitives that already implement a UV-mapping callback for reference.

Uploaded Work
File name/URLFile sizeDate submitted
rt_extrude_uv.diff1.1 KBDecember 14 2014 11:08 UTC
Comments
Michael Huangon December 9 2014 07:19 UTCTask Claimed

I would like to work on this task.

Sean on December 9 2014 07:20 UTCTask Assigned

This task has been assigned to Michael Huang. You have 100 hours to complete this task, good luck!

Sean on December 9 2014 07:23 UTChard task

Michael,


I must admit that this is not a simple task.  However, we're aware of the complexity and will credit you appropriately with however long it takes you to implement a solution.  If the solution takes you more than a few hours, we can and will add additional tasks to reflect efforts to research an approach, implement the approach, test it, etc.  Please keep track of how much time you invest and do ask questions if you get stuck on anything for more than 10 minutes.


Note we don't have a configurable UV mapping, so you just have to define one that works. ;)


 

Michael Huangon December 9 2014 17:51 UTCThanks

I'll keep this in mind!

Michael Huangon December 10 2014 18:37 UTCI'm probably missing something, but...

How might this UV mapping differ from the UV mapping used in rt_ebm_uv?


Would it be possible to just use the X and Y of hitp-hit_vpriv? rt_extrude_shot seems to generate hitp-hit_vpriv properly.

Michael Huangon December 13 2014 09:53 UTCExtension

Hi, may I have an extension for this task? I'm certain I can finish it soon and would like another day to work on it. Thanks.

Harmanpreet on December 13 2014 10:18 UTCDeadline extended

The deadline of the task has been extended with 1 days and 0 hours.

Michael Huangon December 14 2014 11:08 UTCReady for review

The work on this task is ready to be reviewed.

Melange on December 14 2014 11:20 UTCNo more Work can be submitted

Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.

Sean on December 15 2014 05:19 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on December 15 2014 05:24 UTCunsure

Michael,


Sorry that I missed your question, but I wouldn't have had a quick and clear answer for you anyways.  It's very possible that you needed is set there in vpriv and it's entirely possible that the uv mapping that will result is entirely useless.  Still, you indeed did implement a uv-mapping callback and it compiles cleanly, so this task is done.  We'll can create a follow-on tasks to demonstrate/validate that this works and/or to fix it if it's not adequate.


Regardless, thank you again.  This indeed is one of the most complicated tasks we have this year, so really nice work figuring out what was needed!

Sean on January 8 2015 08:57 UTCvv follow-on

A follow-on task to verify/validate that the implementation is correct has been posted: https://www.google-melange.com/gci/task/view/google/gci2014/4547822640693248