eloop Posted July 10, 2006 Share Posted July 10, 2006 I've written a SOP that defines a fixed number of points, then depending on the input parameters moves these points around and builds a new set of primitives. For efficiency I don't gdp->clearAndDestroy() each time, instead I delete all the primitives and define a new bunch on top of the existing points. This works except that when displaying, the resulting surface normals (opengl display only, ie not attributes) aren't being recalculated properly. Simply appending a Facet SOP with no operations selected is enough to get things displaying correctly again. So I'm guessing the clearAndDestroy() is clearing some cached values, how can I do it manually ? Thanks, Drew Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 10, 2006 Share Posted July 10, 2006 Doing gdp->normal(); will recompute the normals, is that all you need? Si Quote Link to comment Share on other sites More sharing options...
eloop Posted July 11, 2006 Author Share Posted July 11, 2006 Yep, that fixed it. I'd trawled across a lot of examples, docs and headers and hadn't run into it ... Thanks. Doinggdp->normal(); will recompute the normals, is that all you need? Si Quote Link to comment Share on other sites More sharing options...
eloop Posted July 11, 2006 Author Share Posted July 11, 2006 Oops, it didn't fix it. This actually adds a normal point attribute. -Drew Yep, that fixed it. I'd trawled across a lot of examples, docs and headers and hadn't run into it ...Thanks. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted July 11, 2006 Share Posted July 11, 2006 Oops, it didn't fix it. This actually adds a normal point attribute.-Drew duplicate answer in another thread. Sorry, I assumed you must have point normals coming in, i've never seen a problem with building geometry with no normals where it shaded wrong. I tend to just do a test for N, if it exists I recalculate them if it doesn't I leave them alone. Odd.... Quote Link to comment Share on other sites More sharing options...
eloop Posted July 12, 2006 Author Share Posted July 12, 2006 For the record the following solution for this was provided by MarkE on the devkit list ... For OGL display, we compute normals into an "internal" attribute. Youprobably just want to clear that. You can do that by: gdp->destroyPointAttrib("internalN", sizeof(UT_Vector3), GB_ATTRIB_MIXED); and in a similar vein over on the sidefx forums, Ondrej gave this solution to another similar sounding situation. I wonder if I should really be doing this, probably more expensive operation, instead ? Without knowing whats going on underneath it's hard to know the correct answer. You'll probably want to call gdp->notifyCache(GU_CACHE_ALL) to ensure that any caches (including display caches) are rebuilt. -Drew Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.